معادل کد زیر در mvc چیست
var s = "Hello";
Response.Redirect("Main.aspx?urlcode=" + s);
کد زیر را می نویسم ارور می دهد
public ActionResult Index()
{
var s = "Hello";
return RedirectToAction("Home?UrlCode=" + s);
}
Printable View
معادل کد زیر در mvc چیست
var s = "Hello";
Response.Redirect("Main.aspx?urlcode=" + s);
کد زیر را می نویسم ارور می دهد
public ActionResult Index()
{
var s = "Hello";
return RedirectToAction("Home?UrlCode=" + s);
}
اکشن Index شما پارامتری به اسم UrlCode نمیگیره !
فکر میکنم شما میخواید به یه اکشن دیگه داخل یه کنترلر دیگه S رو بفرستید ، اگر این هست ، به این شکل عمل کنید :
// Controller1
public ActionResult Index()
{
string s = "Hello";
return RedirectToAction("Index", "Controller2" , s);
}
// Controller2
public ActionResult Index(string UrlCode)
{
}