我希望用戶在成功註冊/登錄後的URL的用戶名,這樣如何在URL中添加用戶名(即URL重寫)?
http://myweb.com/username/255
http://myweb.com/username/settings
我使用ASP.Net重寫模塊,這是我目前使用產生http://myweb.com/home/255
重新寫入規則之一:
<rule name="HomeRewrite" stopProcessing="true">
<match url="^home$"/>
<conditions>
<add input="{URL}" pattern="\.axd$" negate="true"/>
</conditions>
<action type="Rewrite" url="/home.aspx"/>
</rule>
我試着改變自己是這樣的:
<rule name="HomeRewrite" stopProcessing="true">
<match url="^{R:1}/home$"/>
<conditions>
<add input="{URL}" pattern="\.axd$" negate="true"/>
</conditions>
<action type="Rewrite" url="/home.aspx"/>
</rule>
,但它不工作,我知道我做的WR翁。那麼在這方面有什麼幫助?
爲什麼不使用頁面路由?我有一些頁面路由代碼將用戶名添加到路由數據中。還是你想讓瀏覽器地址欄中的網址改變? – 2012-05-30 22:41:21