#1
  1. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Mar 2007
    Posts
    25
    Rep Power
    0

    Master Page - Login Control


    I've created a simple master page. I then created a simple login page and inserted the login control. Next I associated the page to the master page.

    When I view it in SharePoint Designer, it looks great. However, when I select Preview in Browser, the page is not associated with the master page.

    If I login, the page is redrawn and now it magically has the master page association.

    What am I missing?
  2. #2
  3. Moderator From Beyond
    ASP Mastermind (5000+ posts)

    Join Date
    Sep 2004
    Location
    Israel
    Posts
    31,135
    Rep Power
    2922
    post your code for the aspx file and we'll see. we can't guess what's wrong.
  4. #3
  5. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Mar 2007
    Posts
    25
    Rep Power
    0
    Originally Posted by Shadow Wizard
    post your code for the aspx file and we'll see. we can't guess what's wrong.
    ASPX Login Page
    Code:
    <%@ Page Language="C#" masterpagefile="master.master" title="Login" %>
    
    <asp:Content id="Content4" runat="server" contentplaceholderid="head">
    </asp:Content>
    
    <asp:Content id="Content5" runat="server" contentplaceholderid="PageDesc">
    	<h5>Login</h5>
    </asp:Content>
    
    <asp:Content id="Content6" runat="server" contentplaceholderid="sidebar">
    	<h4>Contact Information</h4>
    </asp:Content>
    
    <asp:Content id="Content1" runat="server" contentplaceholderid="Body">
    	<asp:Login runat="server" id="Login1">
    	</asp:Login>
    </asp:Content>
    WEB CONFIG
    Code:
    <?xml version="1.0" encoding="utf-8" ?>
    <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
    	<system.web>
    		<authentication mode="Forms" />
    		<authorization>
    			<deny users="?" />
    		</authorization>
    		<identity impersonate="False" />
    	</system.web>
    </configuration>
    MASTER Page
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <%@ Master Language="C#" %>
    <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
    
    <head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
    <title></title>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
    <link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" type="text/css" href="style.css" />
    </head>
    
    <body style="margin-top: 0; margin-bottom: 0">
    
    <form id="form1" runat="server">
    
    <div class="wrapper">
    	<div style="text-align: center">
    			<a href="http://www.123.xxx">
    			<img alt="Link to Home Page" src="images/123header.jpg" width="625" height="71" /></a></div>
    	<table cellpadding="0" cellspacing="0" border="0">
    		<tr>
    			<td class="header" style="width: 750px; height: 219px">
    			<!--#include file="includes/include_sitename.htm"-->
    			<asp:ContentPlaceHolder id="PageDesc" runat="server">
    			<h5>&nbsp;</h5>
    			</asp:ContentPlaceHolder>
    			</td>
    		</tr>
    		<tr>
    			<td class="navigation">
    			<!--#include file="includes/include_mainnavigation.htm"--></td>
    		</tr>
    		<tr>
    			<td>
    			<table border="0" width="100%" cellspacing="0" cellpadding="0" id="table1">
    				<tr>
    					<td class="sidebar">
    					<asp:ContentPlaceHolder id="sidebar" runat="server">
    						<p>&nbsp;</p>
    						</asp:ContentPlaceHolder>
    					</td>
    					<td class="maintext" valign="top">
    					<asp:ContentPlaceHolder runat="server" id="Body">
    					
    					</asp:ContentPlaceHolder>
    					</td>
    				</tr>
    			</table>
    			</td>
    		</tr>
    		<tr>
    			<td class="footer">
    			<!--#include file="includes/include_footer.htm"--></td>
    		</tr>
    	</table>
    </div>
    
    </form>
    
    </body>
    
    </html>
  6. #4
  7. Moderator From Beyond
    ASP Mastermind (5000+ posts)

    Join Date
    Sep 2004
    Location
    Israel
    Posts
    31,135
    Rep Power
    2922
    the code looks fine.
    do both files reside in the same directory?
    what happens when the user is logging in? is there redirection?
  8. #5
  9. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Mar 2007
    Posts
    25
    Rep Power
    0
    Originally Posted by Shadow Wizard
    the code looks fine.
    do both files reside in the same directory?
    what happens when the user is logging in? is there redirection?
    Yes, all files are in the same directory. (starting to think that may be my issue)
    When the user logs in, all is well the page is displayed correctly. If I select logout, it looses the master page again.

    Should I create a new folder and place the web.config within the folder and my pages that I want to secure, then upon logout, allow the user to go back to the root folder without a web.config?
  10. #6
  11. Moderator From Beyond
    ASP Mastermind (5000+ posts)

    Join Date
    Sep 2004
    Location
    Israel
    Posts
    31,135
    Rep Power
    2922
    no, you don't have to create new folder.
    do you have link to the live website?
  12. #7
  13. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Mar 2007
    Posts
    25
    Rep Power
    0
    Originally Posted by Shadow Wizard
    no, you don't have to create new folder.
    do you have link to the live website?
    Sadly no. We are in the process of updating a webserver to use. In the interim, I am building my site on my XP Pro box. I am primarily using SharePoint Designer, but have installed Visual Web Developer and SQL Express on my box. IIS and ASPX.NET Development Server appear to be working fine.

    So, if you create a simple default.master page and then two plain pages. (ex. welcome.aspx and login.aspx) and associate both to master.master, when you preview in browser, (ie 7.0) your pages look fine? If yes, up to this point mine does to.

    However, once I drag the Login control to the page, save and then preview in browser again, then the pages loose the association to the master.master. I'm stumped.
  14. #8
  15. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Mar 2007
    Posts
    25
    Rep Power
    0
    ** Update

    I went into my IIS/ASP.NET/Edit Config/Authorization TAB/ and found a redundant entry to not allow any unauthorized users to access the site. I deleted the entry, updated, went back to my site and now the page is displayed correctly.

    Strike that up to user error.

Similar Threads

  1. Mysterious redirect to the login page after the user is logged in
    By condeagustin in forum .NET Development
    Replies: 7
    Last Post: January 22nd, 2007, 02:33 PM
  2. Please help with login page
    By elisa in forum ASP Development
    Replies: 8
    Last Post: October 24th, 2006, 05:41 PM
  3. Replies: 10
    Last Post: October 31st, 2005, 05:38 AM
  4. How to access a page control from a web user control
    By double_O_7 in forum .NET Development
    Replies: 2
    Last Post: November 16th, 2004, 10:01 AM
  5. Login page error
    By Steve Schofield in forum ASP Development
    Replies: 1
    Last Post: December 3rd, 2001, 09:12 AM

IMN logo majestic logo threadwatch logo seochat tools logo