Reputation: 73928
I have a MVC 3 web site, when my page first loads, the URL looks like this: http://mysite.com. However, I'd like it to look like this: http://mysite.com?user=123 (?user=123 is the important part).
How do I append a query string at the really begging in Asp.Net MVC 3?
Upvotes: 1
Views: 350
Reputation: 141
something like this. but user becomes 302 Redirect
public ActionResult Index(int? user)
{
if (user == null)
return RedirectToAction("Index", new { user = 123 });
// do something...
}
Upvotes: 4