2017-02-20 269 views
-1

我有服务器请求:​​。获取完整的请求URL - ASP.NET MVC

而且我Action

public ActionResult Index() 
{ 
    stringUrl = ; 
    return RedirectToAction("Index","Home"); 
} 

我想要得到的字符串:“asdhkjashdaskjdhqwehw”Action指数

回答

0

我发现它。 使用:“HttpContext.Request.Url.ToString()

0

您可以发送更多的参数重定向包含您的数据:

public ActionResult Index() 
{ 
    stringUrl = ; 
    return RedirectToAction("Index","Home", new {data = "asdhkjashdaskjdhqwehw" }); 
} 

在您的主页索引操作,你可以在你的行动有说法得到数据:

public ActionResult Index(string data) // data contains the data passed 
{ 
    return RedirectToAction("Your URL"); 
} 
+0

我很抱歉,我的问题不清楚。你可以检查它。 –

+0

您也可以通过使用您的网址的实际参数以类似的方式获取数据 –