User1120430333 posted
ShatterStar
Hi,
I am currently using asp.net mvc attribute routing on my controller but it returns a question mark in the url, here's my code
[Route("ViewAd/{Desc}", Name = "mv")]
public ActionResult ViewSingleAd(string Desc){}
The url it returns is for example "http://mysite.com/View/mv?Desc=Renault-Sandero-900T-Dynamique", how do I get rid of the ? in the url?
The "?" specifies that a variable/parameter "Desc" and its value/data is being passed into the ActionMethod via the URL. The ActionMethod's signature specifies that Desc is to be passed into it.
It's how things work.
https://help.surveygizmo.com/help/url-variables
Is it not suppose to be the below, since you are doing attribute routing? Otherwise, I think you will get a 404 not found as it cannot find the Web ActionMethod based on the URL you have been using. I use ActionName routing myself in WebAPI(s). I have not
used routing in MVC.
"http://mysite.com/ViewAd/mv?Desc=Renault-Sandero-900T-Dynamique"