如何实现像 facebook 或 twitter 这样漂亮的小用户页面 url?
我有一个 .NET 应用程序,我让用户创建他们的帐户.
I have a .NET app and I let users to create their account.
现在用户页面看起来像 http:///user/?user=guru
Right now the user page looks like http:///user/?user=guru
我在应用程序根目录下有一个用户子文件夹,这就是用户页面的 aspx 页面所在的位置
I have a user subfolder at the app root and that is where the aspx pages for user page are
我怎样才能让我的用户访问他们的页面,比如 twitter、facebook 或 youtube?
How can I let my users access their pages like twitter, facebook or youtube?
他们的用户资料频道帐户具有以下格式:http://www.facebook.com/guru
Their user profilechannelaccount has this format: http://www.facebook.com/guru
这样的网址很短,易于记忆和分享
This way the URL is short and easy to remember and share
谢谢
这称为url 重写".在托管应用程序尝试处理它之前,您有一些代码将原始facebook.com/guru"网址转换为facebook.com/?user=guru"网址.
This is called "url rewriting". You have some code that takes the original "facebook.com/guru" URL and coverts it into the "facebook.com/?user=guru" URL before the hosting application tries to process it.
根据您的网络服务器,可能已经构建了一个模块可以让您执行此操作.在 IIS 中,您可以使用自定义 HttpModule 或 URL 重写模块.
Depending on your web server, there is probably a module already built that lets you do this. In IIS, you can either use a custom HttpModule or the URL rewriting module.