Jump to content

ASP.NET WebPages tutorial - adding a logout routine


Recommended Posts

1. ASP.NET/WEBPAGES tutorial. I completed the tutorial and was trying to add a logout function on my Login.cshtml page/file. The WebSecurity.Logout() command would always execute before I want it to. I tried putting it in a button as an onclick option, and tried hidding it in a Jscript function. It seems it would still execute when i didn't want it to. The Login.cshtml file does not have any standard HTML sections,(html, head, body..) The page seems to be controlled by an IF (isPost) option before any processing is performed. I did not devise a way to make my Logout routine work within that IF statement... I was looking for a simple way to add a LOGOUt button/function to work in the Tutorial. site: http://www.w3schools.com/aspnet/webpages_login.asp Also?? Code will Generally, I take it that any/all code written keeps firing away unless it is prevented to, by being inside an IF statement ( or some othe conditional) if its above the <html> or <html> is missing alltogether.. judging/noticed from the .cshtml examples... So, Does Anybody have a few simple lines of code for a Newbie to see how to put a LOGOUT(WebSecurity.Logout()) routine in the login.cshtml file...? I did create a seperate page to perform it, but would like to know how to make it a simple button on the login page, and also to put the Register option ther also... Thanks,\ from a Newbie...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...