Click here to Skip to main content
15,886,049 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionasp.net pdf download problem Pin
UD(IA)13-Sep-11 2:30
UD(IA)13-Sep-11 2:30 
QuestionTwo ways of adding dynamic controls and get their events on run time Pin
basharat8113-Sep-11 1:04
basharat8113-Sep-11 1:04 
AnswerRe: Two ways of adding dynamic controls and get their events on run time Pin
Morgs Morgan14-Sep-11 10:29
Morgs Morgan14-Sep-11 10:29 
QuestionWhat language/tool would you use to create... Pin
Mike Doner12-Sep-11 13:59
Mike Doner12-Sep-11 13:59 
AnswerRe: What language/tool would you use to create... Pin
Abhinav S13-Sep-11 20:04
Abhinav S13-Sep-11 20:04 
QuestionC# designer tool Pin
classy_dog12-Sep-11 12:12
classy_dog12-Sep-11 12:12 
AnswerRe: C# designer tool Pin
Pravin Patil, Mumbai12-Sep-11 21:10
Pravin Patil, Mumbai12-Sep-11 21:10 
QuestionProblems with Site.Master Pin
Rick van Woudenberg12-Sep-11 0:38
Rick van Woudenberg12-Sep-11 0:38 
Dear All,

I'm pretty good with C# however I can't figure out ASP.NET with C#. It's not the C# bit that gives me headaches but the ASP stuff. I have the following problem.

I've created an ASP website ( not entirely true, I used one of VS2010 templates ) and it's has login functionality. I'm using a Postgresql database in the backend and I can login fine. My Site.Master page got buttons in it, but I want a whole new series of buttons when the user has logged on correctly. I've created a new .aspx site that needs to load with a new Master Page. So I've created a new master page, called Site1.Master. It's pretty much the same as Site.Master but it allows me to use different buttons. But for some reason the login information is not display when this new page is loaded. Only after I hit 'F5' on my keyboard ( refresh ) it will show the info and the page works properly.

Site.Master :

ASP.NET
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="Urenboeken.SiteMaster" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
    <title></title>
    <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
    <asp:ContentPlaceHolder ID="HeadContent" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form runat="server">
    <div class="page">
        <div class="header">
            <div class="title">
                <h1>
                    KMO Urenboeken
                </h1>
            </div>
            <div class="loginDisplay">
                <asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false">
                    <AnonymousTemplate>
                        [ <a href="~/Account/Login.aspx" ID="HeadLoginStatus" runat="server">Log In</a> ]
                    </AnonymousTemplate>
                    <LoggedInTemplate>
                        Welcome <asp:LoginName ID="HeadLoginName" runat="server" />!
                        [ <asp:LoginStatus ID="HeadLoginStatus" runat="server" LogoutAction="Redirect" LogoutText="Log Out" LogoutPageUrl="~/"/> ]
                    </LoggedInTemplate>
                </asp:LoginView>
            </div>
            <div class="clear hideSkiplink">
                <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal">
                    <Items>
                        <asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home"/>
                        <asp:MenuItem NavigateUrl="~/About.aspx" Text="Over"/>
                    </Items>
                </asp:Menu>
            </div>
        </div>
        <div class="main">
            <asp:ContentPlaceHolder ID="MainContent" runat="server"/>
        </div>
        <div class="clear">
        </div>
    </div>
    <div class="footer">
        
    </div>
    </form>
</body>
</html>


and my new Site1.Master :

ASP.NET
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="Urenboeken.Site1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head id="Head1" runat="server">
    <title></title>
    <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
    <asp:ContentPlaceHolder ID="HeadContent" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="Form1" runat="server">
    <div class="page">
        <div class="header">
            <div class="title">
                <h1>
                    KMO Urenboeken
                </h1>
            </div>
            <div class="loginDisplay">
                <asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false">
                    <AnonymousTemplate>
                        [ <a href="~/Account/Login.aspx" ID="HeadLoginStatus" runat="server">Log In</a> ]
                    </AnonymousTemplate>
                    <LoggedInTemplate>
                        Welcome <asp:LoginName ID="HeadLoginName" runat="server" />!
                        [ <asp:LoginStatus ID="HeadLoginStatus" runat="server" LogoutAction="Redirect" LogoutText="Log Out" LogoutPageUrl="~/"/> ]
                    </LoggedInTemplate>
                </asp:LoginView>
            </div>
            <div class="clear hideSkiplink">
                <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal">
                    <Items>
                        <asp:MenuItem NavigateUrl="~/Default.aspx" Text="Terug naar Huis"/>
                        <asp:MenuItem NavigateUrl="~/About.aspx" Text="Over van alles en nog wat"/>
                    </Items>
                </asp:Menu>
            </div>
        </div>
        <div class="main">
            <asp:ContentPlaceHolder ID="MainContent" runat="server"/>
        </div>
        <div class="clear">
        </div>
    </div>
    <div class="footer">
        
    </div>
    </form>
</body>
</html>


And my new .aspx file :

ASP.NET
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" 
CodeBehind="Time.aspx.cs" Inherits="Urenboeken.Account.Time" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
</asp:Content>


I load my new .aspx file form the login.aspx when the user is logged on correctly.

C#
public partial class Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //RegisterHyperLink.NavigateUrl = "Register.aspx?ReturnUrl=" + HttpUtility.UrlEncode(Request.QueryString["ReturnUrl"]);
        this.LoginUser.LoggedIn += LoginUser_LoggedIn;
    }
    void LoginUser_LoggedIn(object sender, EventArgs e)
    {
        Server.Transfer("Time.aspx", true);
    }
}


Can someone tell me what I am doing wrong. Or am I going about it in a very wrong way to accomplish what I want. I hope someone can help out.

Kind regards,
AnswerRe: Problems with Site.Master Pin
GenJerDan12-Sep-11 3:39
GenJerDan12-Sep-11 3:39 
AnswerRe: Problems with Site.Master Pin
RichardGrimmer12-Sep-11 5:41
RichardGrimmer12-Sep-11 5:41 
GeneralRe: Problems with Site.Master Pin
Rick van Woudenberg13-Sep-11 12:50
Rick van Woudenberg13-Sep-11 12:50 
Questionasp .net IE9 autocomplete Pin
scarface2112-Sep-11 0:12
scarface2112-Sep-11 0:12 
QuestionURL Rewritting rule Pin
Gaurav Goel (Team Lead)11-Sep-11 21:54
professionalGaurav Goel (Team Lead)11-Sep-11 21:54 
AnswerRe: URL Rewritting rule Pin
David C# Hobbyist.12-Sep-11 13:29
professionalDavid C# Hobbyist.12-Sep-11 13:29 
QuestionSys._SriptLoader._currentTask is null on Google Chrome [modified] Pin
Ali Al Omairi(Abu AlHassan)10-Sep-11 21:01
professionalAli Al Omairi(Abu AlHassan)10-Sep-11 21:01 
QuestionWork in offline mode when internet is offline Pin
md_refay10-Sep-11 20:44
md_refay10-Sep-11 20:44 
AnswerRe: Work in offline mode when internet is offline Pin
Blue_Boy11-Sep-11 5:46
Blue_Boy11-Sep-11 5:46 
QuestionDynamically generate Textboxes with Ajax AutoCompleteExtender how? Pin
anand kumbham9-Sep-11 23:42
anand kumbham9-Sep-11 23:42 
AnswerRe: Dynamically generate Textboxes with Ajax AutoCompleteExtender how? Pin
Ali Al Omairi(Abu AlHassan)11-Sep-11 20:04
professionalAli Al Omairi(Abu AlHassan)11-Sep-11 20:04 
Questionwebpages for 2010 Pin
Member 82175179-Sep-11 18:37
Member 82175179-Sep-11 18:37 
AnswerRe: webpages for 2010 Pin
David C# Hobbyist.10-Sep-11 14:56
professionalDavid C# Hobbyist.10-Sep-11 14:56 
QuestionFetching response from a different web server Pin
CodingYoshi9-Sep-11 6:38
CodingYoshi9-Sep-11 6:38 
QuestionDropDownList MVC Pin
awadhendra tiwari8-Sep-11 21:39
awadhendra tiwari8-Sep-11 21:39 
QuestionCustom validation Pin
jashimu8-Sep-11 5:02
jashimu8-Sep-11 5:02 
AnswerRe: Custom validation Pin
David C# Hobbyist.8-Sep-11 15:28
professionalDavid C# Hobbyist.8-Sep-11 15:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.