Problems with Site.Master
-
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 :
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="Urenboeken.SiteMaster" %>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
<title></title></head>
<body>
<form runat="server">KMO Urenboeken
====================================================
\[ [Log In](~/Account/Login.aspx) \] Welcome ! \[ \]
-
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 :
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="Urenboeken.SiteMaster" %>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
<title></title></head>
<body>
<form runat="server">KMO Urenboeken
====================================================
\[ [Log In](~/Account/Login.aspx) \] Welcome ! \[ \]
Often, when a problem is "fixed" by a browser refresh, it's because of caching (in the browser or in the proxy). If the "new" page has the same name as the old page and the timestamp of the aspx itself hasn't changed (like it has a new master or CSS or something else external to it), the browser will just say to itself "I already have this in my cache. Not gonna bother downloading another copy." Yeah, okay, it's doing a HEAD before a GET, and if the HEAD isn't different from the last HEAD it got, it won't do anything. But that's a boring way to put it.
Just like that old Carly Simon song... "You're so funny, You probably think this joke is about you" My Mu[sic] My Films My Windows Programs, etc.
-
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 :
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="Urenboeken.SiteMaster" %>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
<title></title></head>
<body>
<form runat="server">KMO Urenboeken
====================================================
\[ [Log In](~/Account/Login.aspx) \] Welcome ! \[ \]
I suspect that the issue is with the Server.Transfer - try swapping it out for a Response.Redirect.. Server.Transfer only (IIRC) changes the "context" on the server, so as far as the server's concerned, you're on that page, but as far as the client is concerned, you're still on the original page. Response.Redirect should keep the browser end in check too.
C# has already designed away most of the tedium of C++.
-
I suspect that the issue is with the Server.Transfer - try swapping it out for a Response.Redirect.. Server.Transfer only (IIRC) changes the "context" on the server, so as far as the server's concerned, you're on that page, but as far as the client is concerned, you're still on the original page. Response.Redirect should keep the browser end in check too.
C# has already designed away most of the tedium of C++.
Richard, Thank you for your reply. Response.Redirect fixed the problem. And also many thanks to GenJerDan for explaining to me what caused the issue in the first place. Kind regards,