如何在使用网址路由在asp.net 4.0中处理url中的特殊字符?在asp.net 4.0 web表单的url路由中的特殊字符?
特殊字符像(&。)
它显示错误坏请求或URL危险特性。
如何处理?
假设我有在Global.asax中的URL路由文件
protected void Application_Start(object sender, EventArgs e)
{
CustomRouteTable(RouteTable.Routes);
}
void CustomRouteTable(RouteCollection routes)
{
routes.MapPageRoute("Product", "Product/{pId}/{ProductName}", "~/Product/ProductDetail.aspx");
}
假设产品名称是电话&无绳电话或:无绳 然后我得到的错误。
如何处理?
我无法在/ phone/Cordless中查询查询字符串。如果我以无绳(p)参数结束,该怎么办?然后url/Product/1/Cordless(p)。 –
我有一个网址http://www.dominicpettifer.co.uk/Blog/34/asp-net-mvc-and-clean-seo-friendly-urls。使用描述的方法会好吗? –