我有一个函数从该函数返回字符串值。下面显示了我的一些代码
<code>
public string MainPane()
{
if (Request.Cookies["Cookie"] != null)
{
try
{
//DO Something code here
}
catch (Exception ex)
{
}
return("");
}
else
{
//I need to redirect from here when cookie value is null
}
</code>谢谢,
尼拉夫·帕里克
这是我的asp.net MVC应用程序
Response.Redirect("Index"); 此功能不可用。我试过
RedirectToAction("Action Name","Controller Name"); 但是函数返回字符串值,而RedirectToAction不返回字符串。
谢谢你,尼拉夫
发布于 2013-03-26 12:35:44
您可以使用:
Response.Redirect("Index");它将重定向您,而不需要返回一个ActionResult。
https://stackoverflow.com/questions/15636896
复制相似问题