开发者

IIS 6 : redirect the pages in asp

I am using IIS 6 and classic ASP. I don't have access of hosting server. I want to create redirect pages.

www.example.com/location/123

to

www.example.com/location.asp开发者_开发问答?id=123

Do I need to create some function in global.asa file?


There's really only a couple of ways to achieve this if you're using classic ASP:

  1. If your hosting provider provides access to a url rewriter as part of their package (ISAPI_Rewrite for example) then you could rewrite the friendly urls.

  2. If your hosting provider doesn't provide support for a url rewriter but does allow you to change the 404 error handler to a custom script then you could parse the url then do a Server.Transfer to location.asp?id=xxxx. Here's an article describing such a mechanism:

    http://www.stronghost.co.uk/URL-Rewrites-and-IIS-/-ASP/B7.htm

    Most providers will allow you to do this as it's a fairly basic hosting requirement. You might need to ask them to do this in a support ticket if their control panel doesn't allow this.


In the page load using c# you could do

Response.Redirect("~/location.asp?id=123");

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜