asp.net mvc 3 - Get Keyvalue from URL (Inside View) -


how can last part of url string inside .cshtml view?

http://localhost:10000/businessobject/browse?name=game 

the value need name -> here "game".

keys:

"{controller}/{action}/{id}/{name}" 

to controllers or actions , on use this:

url.requestcontext.routedata.values["controller"].tostring();  url.requestcontext.routedata.values["action"].tostring(); 

but can tell me how similiar namevalue - "game"?

assuming method in c# looks this:

    public actionresult browse(string name)     {        //do whatever        return view()     } 

if case drop name viewbag:

public actionresult browse(string name)         {            //do whatever            viewbag.name = name;            return view()         } 

then on webpage:

<p>@viewbag.name<p/> 

Comments