如何为动态页面重命名asp.net的URL [英] How to rename url for asp.net for dynamic pages
本文介绍了如何为动态页面重命名asp.net的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
http://inventorsrealty.com/ViewDetailsProject.aspx?propid=198 [ ^ ]
是我的网址,我想将其重命名为invencerealty.com/properties-gigevilla-karanjade。我如何实现这一目标?
http://inventorsrealty.com/ViewDetailsProject.aspx?propid=198[^]
is my url and i want to rename it to inventorsrealty.com/properties-gigevilla-karanjade.How can I achieve this?
推荐答案
参考:
http://issuesdotnet.blogspot.in/2010/07 /url-rewriting-making-user-friendly-urls.html [ ^ ]
试试这个
< a href =http://www.codeproject.com/Articles/641758/An-Example-of-URL-Rewriting-With-ASP-NET>使用ASP.NET重写URL的示例 [< a href =http:// www。 codeproject.com/Articles/641758/An-Example-of-URL-Rewriting-With-ASP-NET\"target =_ blanktitle =新窗口> ^ ]
你的web.config文件中的
添加以下内容
< urlMappings enabled =" true">
< add url ="〜/ Page1" mappedUrl = QUOT;〜/&的Login.aspx QUOT; />
< / urlMappings>
这里login.aspx是要映射的网址和Page1是完成映射的url名称。
当你调用Response.Redirect(" Login.aspx");而是调用Response.Redirect(" Page1")并且同样适用于所有地方
这是映射网址的最简单方法
in your web.config file add the following
<urlMappings enabled="true">
<add url="~/Page1" mappedUrl="~/Login.aspx" />
</urlMappings>
here login.aspx is the url to be mapped and Page1 is url name into which mapping is done.
when u call Response.Redirect("Login.aspx"); instead call Response.Redirect("Page1")and same applies everywhere
this is the simplest way to map url
这篇关于如何为动态页面重命名asp.net的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文