Norque Norque - 2 months ago 8x
ASP.NET (C#) Question

redirect user to home page or disable a submit button if not logged in

I've got a page to submit data into a database and I want to either re-direct them to a different page if they arent logged in OR disable the submit button at the bottom. I'm doing this in my page load event of the page to be denied access.

I've researched and found this in many spots but what exactly am I placing into Session["???"] I'm using the login/register feature provided by Web Forms

protected void Page_Load(object sender, EventArgs e)
if (Session[] == null)




You can use HttpContext.Current.User.Identity.IsAuthenticated to check if there is authenticated user or not