url rewrite

D

dodgeyb

newbie to asp.net url rewriting and need help understanding.

if I simply add to global.asax file :

Protected Sub Application_BeginRequest(ByVal sender As Object, ByVal e
As System.EventArgs)

If InStr(Request.CurrentExecutionFilePath,
"userfriendlyurl.aspx") Then
Context.RewritePath("realurl.aspx", False)
End If
End Sub


This appears to work fine.

what relevance / need is there to involve httpHandlers or
httpModules ?

cheers
Chris
 
M

Michael Nemtsev [MVP]

Hello dodgeyb,

using httpHandler allows you to extract you rewrting to the separate dlll
and distribute it amon different projects, not only current one

---
WBR,
Michael Nemtsev [Microsoft MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


d> newbie to asp.net url rewriting and need help understanding.
d>
d> if I simply add to global.asax file :
d>
d> Protected Sub Application_BeginRequest(ByVal sender As Object, ByVal
d> e As System.EventArgs)
d>
d> If InStr(Request.CurrentExecutionFilePath,
d> "userfriendlyurl.aspx") Then
d> Context.RewritePath("realurl.aspx", False)
d> End If
d> End Sub
d> This appears to work fine.
d>
d> what relevance / need is there to involve httpHandlers or httpModules
d> ?
d>
d> cheers
d> Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top