[英]How do I rewrite URLs without access to IIS using C# and ASP.NET?
I am looking for a solution to rewrite URLs that have query strings so that the query string creates permanent link. 我正在寻找一种重写具有查询字符串的URL的解决方案,以便查询字符串创建永久链接。 For example: the query string ?u=test would become http://www.website.com/profile/test 例如:查询字符串?u = test将变为http://www.website.com/profile/test
I am new to URL rewriting, but am open to any suggestions you may have. 我是URL重写的新手,但欢迎您提出任何建议。 I don't have access to IIS as I'm using shared virtual hosting. 我正在使用共享虚拟主机,因此无法访问IIS。
You cant have extension-less URL without configuring it in the IIS as ISAPI wouldn't know how to handle that request. 如果没有扩展名的URL,则无法在IIS中对其进行配置,因为ISAPI不知道如何处理该请求。
Scott Gu has an excellent post with various approaches to URL rewrite. Scott Gu在一篇出色的文章中介绍了多种URL重写方法。
You can use ASP.NET routing engine (introduced in .NET 3.5 SP1), see this article for quick-start: http://msdn.microsoft.com/en-us/magazine/dd347546.aspx 您可以使用ASP.NET路由引擎(在.NET 3.5 SP1中引入),有关快速入门,请参阅此文章: http : //msdn.microsoft.com/zh-cn/magazine/dd347546.aspx
BTW, although outdated, you should read Scott Gu's post sighted by Danish for various options. 顺便说一句,尽管过时了,但您应该阅读丹麦人见过的Scott Gu的帖子,提供各种选择。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.