0

how can I remove empty paramaters from Url:

http://localhost:12058/User/Doctors?pageNumber=1&HospitalId=&DepartmentId=&specialityId=&name=&email=

In my case I want clean Url from: name=&email=

I try do this:

routes.MapRoute(null, "{controller}/{action}/{id}", // URL with parameters
        new { controller = "User", name = UrlParameter.Optional, email = UrlParameter.Optional });

but it is not work for me

revolutionkpi
  • 2,632
  • 10
  • 45
  • 84
  • I want to have url without empty parameters – revolutionkpi Aug 08 '12 at 08:11
  • If the suggestion below solved your problem, please mark the question as solved by clicking the tickbox to the left of the answer. – simme Aug 08 '12 at 08:13
  • Yes, I understand what you want: what have you *tried*? – Dan Puzey Aug 08 '12 at 08:34
  • I try the code I wrote in my question (routes.MapRoute(null, "{controller}/{action}/{id}", // URL with parameters new { controller = "User", name = UrlParameter.Optional, email = UrlParameter.Optional }); ) in Global.asax – revolutionkpi Aug 08 '12 at 11:42

0 Answers0