Last post Dec 05, 2007 02:12 AM by 00Mike
Nov 28, 2007 12:07 AM|00Mike|LINK
Hi everyone, I've been looking at url rewriting and have tried it multiple ways. Class, handler mappings, Modules, Global ASAX file. All work fine in ASP.Net development server however all either fail or produce an error when I run the browser with "script debugging." I've
given up on doing it this way. Could anyone give me step by step assistance on the best way to achieve url rewriting in IIS 7 even if I have to scrap my existing code!? I've not touched thiis code for months so sorry if I'm a little slow, but I've had no need
for it until now.
This is the kind of code I'm currently trying to implement. Yes I know, it's not written terribly well (line 17)
Public Class Scriber
Public Sub Init(ByVal context As System.Web.HttpApplication) Implements System.Web.IHttpModule.Init
AddHandler context.BeginRequest, AddressOf onBeginaddress
Private Sub onBeginaddress(ByVal sender As Object, ByVal e As EventArgs)
Dim httpApp As System.Web.HttpApplication
httpApp = CType(sender, System.Web.HttpApplication)
httpApp.Context.RewritePath(Replace(httpApp.Context.Request.RawUrl.ToLower, "UserProfile.aspx?id=5", "Max.aspx"))
Oh and sorry to Jeff for posting this in the wrong place...
Thanks in advance
Dec 05, 2007 12:11 AM|betawiz|LINK
You should try Scott Guthrie's article about "Tip/Trick: Url Rewriting with ASP.NET "
Dec 05, 2007 02:12 AM|00Mike|LINK
Sorry I forgot to mention I solved the issue with the same article earlier
Thanks that works. Though I'd like to know how to do that for extensions.they're the ones generating this strange error