url rewrite

Discussion in 'ASP .Net' started by dodgeyb, Jul 16, 2008.

  1. dodgeyb

    dodgeyb Guest

    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
     
    dodgeyb, Jul 16, 2008
    #1
    1. Advertising

  2. 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
     
    Michael Nemtsev [MVP], Jul 17, 2008
    #2
    1. Advertising

  3. dodgeyb

    dodgeyb Guest

    gotcha. thanks v. much. Chris
     
    dodgeyb, Jul 17, 2008
    #3
  4. dodgeyb

    George Guest

    I would like to add that there is more to Url rewriting than just that.
    I wrote a set of articles about .NET applications and one is about Url
    rewriting.
    you can visit them here
    http://georgeplusnet.blogspot.com/2008/06/perfect-aspnet-application-part-0.html

    This
    http://georgeplusnet.blogspot.com/2008/06/perfect-aspnet-application-part-7.html
    one is about Url rewriting but you might want to start from the beginning.

    George.


    "dodgeyb" <> wrote in message
    news:...
    > 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
     
    George, Jul 17, 2008
    #4
  5. dodgeyb

    dodgeyb Guest

    Excellent, I'll definately have a read.
    Cheers
    Chris
     
    dodgeyb, Jul 19, 2008
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michel

    Rewrite URL with Session possible?

    Michel, Dec 9, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    430
    Michel
    Dec 9, 2003
  2. DDK
    Replies:
    1
    Views:
    422
    Eric Lawrence [MSFT]
    Mar 2, 2004
  3. =?Utf-8?B?amF2YXd6bA==?=

    URL Rewrite to classic ASP

    =?Utf-8?B?amF2YXd6bA==?=, Apr 29, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    3,124
    =?Utf-8?B?amF2YXd6bA==?=
    Apr 29, 2005
  4. =?Utf-8?B?VA==?=

    Rewrite asp url as aspx url?

    =?Utf-8?B?VA==?=, Jul 22, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    760
    gerry
    Jul 24, 2005
  5. Martin
    Replies:
    0
    Views:
    1,268
    Martin
    Apr 28, 2010
Loading...

Share This Page