ASP.NET MVC 4 C# - Get Sectioned Elements or full URL to Parse

x96

New Member
Being kind of a newb to MVC 4 (or really any of the MVC's for ASP.NET) I cant help but feel theres more to the URL helper than what I'm seeing. Basically I've read the tutorials on populating the attributes in a controllers methods using a query string in the URL. I dont liek query strings though and prefer a sectioned "folder" like style. Without much further adu, this is the sample URL:http://something.com/DataTypes/Search/searchStringthis approach is actually pretty safe as there will only ever be single worded searchesI have tried in the DataTypes controller\[code\] [HttpGet] public ActionResult Search(String q) { ViewBag.ProvidedQuery = q; return View(); }\[/code\]and a few other small variations, right now im just trying to get the string to show up in the view but I dont seem to be getting anything there. Is there anyway to inject the 3rd string in the url into an attribute? If not, which URL helper class am I supposed to use to acquire the string data in the URL? Even if I have to parse the whole URL manually so be it, i just need to acquire that 3rd element in the URL as a stringExtremely n00b question im sure, but either im not finding this simple guide somewhere, or im not searching google correctly...
 
Back
Top