views:

24

answers:

0

Hi all,

I'm working on an ASP.NET web application. We've got a login page (index.aspx), as well as a user's "home page", userhome.aspx. What's the most elegant way to deny a user to display index.aspx when they're logged in? At the moment, index.aspx can still be displayed by explicitly typing it into the browser address bar.

I tried the following (in web.config), but it does not work:

<location path="index.aspx">
  <system.web>
    <authorization>
      <deny roles="MyUserRole" />
    </authorization>
  </system.web>
</location>

I could perform a manual redirection in code behind, but it looks pretty ugly to me. Thanks a lot for any more elegant approach :)

Cheers, Matthias