How To Have Multiple Login Page Styles In ASP.Net
<p>My site will have a few tools/sub-sites available for people to do different things.  I have one common Login UserControl that will be used so I am not really duplicating much.  But each of these sub-sites have their own MasterPage and thus styling.  There is only one User table in the database and there are Roles for which sub-site you can get to.  The Login UserControl will handle that.</p>

<p>Here is a simplized folder structure:</p>

<p>\Root</p>

<p>--> Images</p>

<p>--> Scripts</p>

<p>--> Styles</p>

<p>--> POHR</p>

<p>------> Login.aspx</p>

<p>------> PORHMasterPage</p>

<p>--> Beer</p>

<p>------> Login.aspx</p>

<p>------> BeerMasterPage</p>

<p>--> StatusUpdates</p>

<p>------> Login.aspx</p>

<p>------> StatusUpdatesMasterPage</p>

<p>Each of those Login Pages use the same Login UserControl which validates people and sets up a Cookie as see here:</p>

<pre><code>public void LogUserIn(string EMailOrName, string Password) {
  DS.User u = DS.Common.ValidateUser(EMailOrName, Password);

  if (u != null) {
    FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
      1,
      u.FirstName + " " + u.LastName,
      DateTime.UtcNow,
      DateTime.UtcNow.AddMinutes(30),
      true,
      string.Format("UserID={0}|SiteID={1}", u.ID, SiteID)
    );
    string eTicket = FormsAuthentication.Encrypt(ticket);
    HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, eTicket);
    Response.Cookies.Add(cookie);

    string redirectUrl = FormsAuthentication.GetRedirectUrl(EMailOrName, true);
    Response.Redirect(redirectUrl);
  } // if they got authenticated
} // LogUserIn - Method
</code></pre>

<p>My issue is the FormsAuthentication.GetRedirectUrl.  It is returning /default.aspx.  I tried adding the following to the Web.config</p>

<pre><code>&lt;location path="~/StatusUpdates"&gt;
  &lt;system.web&gt;
    &lt;authentication mode="Forms"&gt;
      &lt;forms loginUrl="~/StatusUpdates/Login.aspx" defaultUrl="~/StatusUpdates/Dashboard.aspx" timeout="30" slidingExpiration="false" name="MGG_StatusUpdates" /&gt;
    &lt;/authentication&gt;
  &lt;/system.web&gt;
&lt;/location&gt;

&lt;location path="~/Beer"&gt;
  &lt;system.web&gt;
    &lt;authentication mode="Forms"&gt;
      &lt;forms loginUrl="~/Beer/Login.aspx" defaultUrl="~/Beer/Dashboard.aspx" timeout="30" slidingExpiration="false" name="MGG_Beer" /&gt;
    &lt;/authentication&gt;
  &lt;/system.web&gt;
&lt;/location&gt;
</code></pre>

<p>I would expect a page the above defaultUrl values to be passed back based on where I am in the application.</p>

<p>My questions are... How can I get this to do what I want?  Do I need Web.config files in each of those folders, if so, what should they hold as well as what should the root's web.config file have.</p>
