简体   繁体   中英

How to implement URL Rewriting in ASP.Net?

In my project i want to implement url rewrite . At present my urls like http://example.com/?user=someone&time=20min . I want to make it like http://example.com/someone/20mins/

I tried the examples mentioned here

www.c-sharpcorner.com/UploadFile/akkiraju/url-rewriting-in-Asp-Net/

But getting issue , like PAGE NOT FOUND error.

I followed same instructions and hosted my application in IIS as well.

Thanks, venky.

In the web page you mentioned the code is like this : 码

I presume the problem being the absolute url starting with "/". Replace it with tilde and slash "~/" and see if it works :

eg. : instead of : translationPath="/MyPage?Param1=x&Param2=y" use : "~/MyPage?Param1=x&Param2=y"

I'm guessing that you have hosted your app on a virtual directory in IIS. That's why it cannot find the address.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM