• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 264
  • Last Modified:

login page does not show master page contents

I have a Login.aspx page that I created based upon a "MasterPage.master" page.  It looks fine in the designer but when I go to run it the login control shows up but there is no formatting almost as if the MasterPage.master or CSS are disconnected.  I then login and everything is fine.

The startup page is "Default.aspx" but the user is taken to the "Login.aspx" page because these "web.config" settings:

    <authorization>
        <deny users="?" />
    </authorization>
   
    <authentication mode="Forms">
      <forms loginUrl="Login.aspx" path="/" />
    </authentication>
LOGIN PAGE: 
 
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" Title="Untitled Page" %>
<script language="C#" runat="server">
 
    void Login_Click(Object sender, EventArgs E) {
        if (((UserEmail.Value == "test") && (UserPass.Value == "password")) || ((UserEmail.Value == "test") && (UserPass.Value == "password")))
        {
        FormsAuthentication.RedirectFromLoginPage(UserEmail.Value, PersistCookie.Checked);
      }
      else {
        Msg.Text = "Invalid Credentials: Please try again";
      }
    }
 
  </script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphMainContent" Runat="Server">
    <form runat="server">
    <h3><font face="Verdana">Login Page</font></h3>
 
      <table>
        <tr>
          <td>Username:</td>
          <td><input id="UserEmail" type="text" runat="server"/></td>
          <td><ASP:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="UserEmail" Display="Static" ErrorMessage="*" runat="server"/></td>
        </tr>
        <tr>
          <td>Password:</td>
          <td><input id="UserPass" type="password" runat="server"/></td>
          <td><ASP:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="UserPass" Display="Static" ErrorMessage="*" runat="server"/></td>
        </tr>
        <tr>
          <td>Persistent Cookie:</td>
          <td><ASP:CheckBox id="PersistCookie" runat="server" /> </td>
          <td></td>
        </tr>
      </table>
 
      <asp:button ID="Button1" text="Login" OnClick="Login_Click" runat="server"/>
 
      <p>
 
      <asp:Label id="Msg" ForeColor="red" Font-Names="Verdana" Font-Size="10" runat="server" />
    </form>  
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cphLeftNavigation" Runat="Server">
</asp:Content>

Open in new window

0
manivineet
Asked:
manivineet
1 Solution
 
Gyanendra SinghArchitectCommented:
add this in your web config

      <location path="Path of your CSS and Image file">
            <system.web>
                  <authorization>
                        <allow users="*" />
                  </authorization>
            </system.web>
      </location>
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Tackle projects and never again get stuck behind a technical roadblock.
Join Now