我的网址是PrintProductInvoice.aspx?id = 39&n =我想要将我们的网址路由为PrintProduct / abc。我是按数据库获取的。
如何更改您的网址。
从您的问题来看,我认为您希望能够生成不依赖于物理文件名的URL模式。
这可以通过使用ASP.NET路由来实现。
这是你的路线配置或多或少的样子:
void RegisterRoutes(RouteCollection routes)
{
routes.MapPageRoute("PrintRoute",
"PrintProduct/{product}",
"~/PrintProductInvoice.aspx");
}
你可以称之为:'http://youraddress.com/PrintProduct/abc'
为了配置您的路线,您需要在项目中进行一些最小的设置工作,如文章here中所述。