User.Identity/Login not working with URL rewriting

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bradleyhogan
    New Member
    • Feb 2009
    • 4

    User.Identity/Login not working with URL rewriting

    I had implemented urlrewritingnet successfully but after adding forms
    authentication, none of the login controls work on the rewritten
    pages.

    <add name="Keyword" virtualUrl="^~/(.*)"
    rewriteUrlParam eter="ExcludeFr omClientQuerySt ring"
    destinationUrl= "~/results.aspx?Ke yword=$1"
    ignoreCase="tru e" />

    On page results.aspx, the loginstatus control incorrectly shows
    "login" although the user is, indeed, logged in. The same is true for
    the loginname control. I had also tried to write vb code with an "if
    User.IsAuthenti cated" but it threw "object reference not set to
    instance of an object" at that line.
    Any advice? Thanks, Bradley
  • PRR
    Recognized Expert Contributor
    • Dec 2007
    • 750

    #2
    Take a look at this article by Scott Mitchell....
    "To fix these subtleties, you might decide to perform the URL rewriting in the AuthorizeReques t event. While this approach fixes the URL authorization and forms authentication anomalies..."

    "So, when should URL rewriting be performed in an HTTP module? It depends on what type of authentication you're employing. If you're not using any authentication, then it doesn't matter if URL rewriting happens in BeginRequest, AuthenticateReq uest, or AuthorizeReques t. If you are using forms authentication and are not using Windows authentication, place the URL rewriting in the AuthorizeReques t event handler. Finally, if you are using Windows authentication, schedule the URL rewriting during the BeginRequest or AuthenticateReq uest events."

    Comment

    • bradleyhogan
      New Member
      • Feb 2009
      • 4

      #3
      Thanks, DeepBlue. I figured that it had to do with where it was being fired, but I don't know how to change that using urlrewritingnet . It appears to fire at the BeginRequest. I was hoping that it could be modified to fire at AuthorizeReques t.

      Bradley

      Comment

      Working...