How to make .NET WebForm Routing work with Authorization

Posted by jakmas on Stack Overflow See other posts from Stack Overflow or by jakmas
Published on 2010-12-21T18:50:25Z Indexed on 2010/12/21 18:54 UTC
Read the original article Hit count: 266

Filed under:
|
|
|
|

I have routes that are being registered from the database into an asp.net website (non MVC). The routes register fine, they all work when I am logged in. What I am trying to do is create a landing page based on some route data:

Page is [site]/landing/dell

The route looks like: "landing/{client}" and it routes to my page Login.aspx, in there I get the client out of the route, then display some custom brand data based on the value.

In my web.config, I have my authentication mode set to forms, with my loginUrl = "Login.aspx"

When the user does not have the authorization cookie, it redirects the user to:

[site]/Login.aspx?ReturnUrl=%2flanding%2fdell instead of keeping the route url, and displaying the correct data. The IIS server actually does not even process the route at all, just sends the user to the Login.aspx page.

I have tried several additions to my web.config: etc, and many variations, but nothing seems to work.

Ideas anyone? I assume this is a common issue, and it is just not well documented.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about mvc