Check Session variable and Redirect to login page before page load
问题 How can I check a variable and redirect to another page before the page loads using ASP.NET? I'm aware of the life cycle, and PageInit() sounds like it would be right, but I can't seem to find anywhere to put the code without and error within Visual Studio. I can't put the onpageinit="" within the first line of my page declaration. Am I suppose to put it somewhere different? My page declaration looks like: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="dashboard.aspx.cs" Inherits=