获取完整请求 url - ASP.NET MVC
Getting full request url - ASP.NET MVC
我有这样的服务器请求:"http://localhost/Login/Index?asdhkjashdaskjdhqwehw"
。
还有我的 Action
:
public ActionResult Index()
{
stringUrl = ;
return RedirectToAction("Index","Home");
}
我想获取字符串:"asdhkjashdaskjdhqwehw" in Action
Index.
您可以通过发送包含您的数据的附加参数来重定向:
public ActionResult Index()
{
stringUrl = ;
return RedirectToAction("Index","Home", new {data = "asdhkjashdaskjdhqwehw" });
}
在您的 Home Index 操作中,您可以通过操作中的参数获取数据:
public ActionResult Index(string data) // data contains the data passed
{
return RedirectToAction("Your URL");
}
我找到了。
使用:“HttpContext.Request.Url.ToString()
”
我有这样的服务器请求:"http://localhost/Login/Index?asdhkjashdaskjdhqwehw"
。
还有我的 Action
:
public ActionResult Index()
{
stringUrl = ;
return RedirectToAction("Index","Home");
}
我想获取字符串:"asdhkjashdaskjdhqwehw" in Action
Index.
您可以通过发送包含您的数据的附加参数来重定向:
public ActionResult Index()
{
stringUrl = ;
return RedirectToAction("Index","Home", new {data = "asdhkjashdaskjdhqwehw" });
}
在您的 Home Index 操作中,您可以通过操作中的参数获取数据:
public ActionResult Index(string data) // data contains the data passed
{
return RedirectToAction("Your URL");
}
我找到了。
使用:“HttpContext.Request.Url.ToString()
”