asp.net mvc url to string
i am creating mvc application and is it possible to get the url to string somehow? my url is like:http://localhost:7264/Asortiman/Browse?kategorije=327 and in the head of some view i would like to get this url like stri开发者_JAVA技巧ng and take last 3 digits in this case 327 and use it as param in my function.
Why dont you do it at the Controller level and send it with the ViewBag dynamic object?
I Suppose your Controller is Asortiman and your Action method is Browse. Then if you define your method like;
public ActionResult Browse(int kategorije){
ViewBag.KategoriJe = kategorije;
return View();
}
Then at the view you can now reach it with the same dynamic object. For further use see the default mvc application project at the vs2010
精彩评论