Question

I have menu items Home, About, and Contact. I only want Home to be accessible by Anon users, and About/Contact to be accessible by authenticated users. This works great using a Sitemap and using SecurityTrimming. My issue is that it seems when an Anon user clicks on About/Contact, the default redirect is login.aspx. Since my Login.aspx page is in a folder called Accounts (I also have other management pages here) I need to change the redirect URL from "login.aspx" to "~/Accounts/Login.aspx" I have been searching for a way to configure this for a few hours now to no avail. Any suggestions?

Was it helpful?

Solution

of course, after hours of trying to find the answer to this, I post a StackOverflow question and find the answer immediately after. For future Googlers...

First, make sure you are using

<authentication mode="Forms">

</authentication>

Then, inside of this, make sure you are using a "forms" node with a "loginurl" attribute. Set that attribute to your login page URL ("~/Account/Login.aspx" in my case).

<form loginUrl="~/Account/Login.aspx" />

Leaving you this (at the bare-minimum)

<authentication mode="Forms">
    <form loginUrl="~/Account/Login.aspx" />
</authentication>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top