从空参数中清除URL

时间:2012-08-08 07:35:32

标签: c# asp.net-mvc asp.net-mvc-3

如何从Url中删除空参数:

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

就我而言,我想要来自name=&email=

的干净网址

我尝试这样做:

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

但这对我不起作用

0 个答案:

没有答案
相关问题