C# 如何在mvc4 razor中从公共类重定向url

C# 如何在mvc4 razor中从公共类重定向url,c#,razor,C#,Razor,我想在将邮件发送到活动页面后重定向页面。我已经创建了SendMail和Controller模型 在模型SendMail.cs中,我正在获取数据: public class SendMail { public string Name { get; set; } public string Email { get; set; } public string Comment { get; set; } } 在控制器SendMail中: [HttpGet] public ActionR

我想在将邮件发送到活动页面后重定向页面。我已经创建了SendMail和Controller模型

在模型SendMail.cs中,我正在获取数据:

public class SendMail
{
  public string Name { get; set; }
  public string Email { get; set; }
  public string Comment { get; set; }
}
在控制器SendMail中:

 [HttpGet]
 public ActionResult SendMail()
 {
   return View();
 }
 [HttpPost]
 public string SendMail(SendMail SendMail)
 {
  if (!String.IsNullOrEmpty(SendMail.Name) && !String.IsNullOrEmpty(SendMail.Email) && !String.IsNullOrEmpty(SendMail.Comment))
  {
    //Sending Mail SMPT Setting                    
    return Url;
  }
  else
  return Url;
  }
它工作得很好,但我不明白如何在发送邮件后重定向公共字符串SendMail类中的活动Url

在发送邮件之前 发送邮件后

谢谢

你能试试这个吗

[HttpPost]
 public ActionResult SendMail(SendMail SendMail)
 {
  if (...)
  {
    //Sending Mail SMPT Setting    
    return RedirectToRoute(URL);
  }
  else
  return RedirectToRoute(URL);
}
我认为您需要通过ActionResult更改字符串才能重定向。
我希望它能帮上忙。

我想调用该页面的URL,我处于活动状态,如何通过java脚本读取该页面并将其发送到重定向路由(URL);