Login/ Logout

Problem! Example, i have 1, 2, 3, 4 aspx and 2, 3 and 4 aspx are mend

for administrator. How do i set the login first for 2,3,4 aspx if the

administrator have yet to login?

Next there's a problem with logout, how do i bring the user to another page when logout is click and disable the back button?

[326 byte] By [arcliner] at [2007-12-22]
# 1

you can redirect the user to another page if they logout:

Response.Redirect("somepage.aspx")

as for logging in, I guess if page 1 was the login page, you would check with say, SQL, if the user exists and is an admin, and if they are then to store an object or something in session (Session.Add("key", object)), which will hold the details of the user for example or perhaps some value to indicate they are the administrator.

Once this has been done on the login page, as for the rest of the pages for it to only be seen by the administrator, on page_load, make sure you do a check on the Session. The check should check that the key added/object added is a valid and an object which indicates that the user logged in is in fact an administrator, if not, then redirect them somewhere else or hide the controls on the page.

hope this helps!

ahmedilyas at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 2
Not very sure on how the code is written. Can i use the LoginView to do the checking instead of SQL? If so how do i write the actual coding in VB Language? (Vb.net 2005)
arcliner at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 3

well how exactly are you going to check to see if the user exists in the database? the database holds all the user credential details (or it should at least)

I guess you could use the loginview class although I've never used it:

http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.loginview.aspx

ahmedilyas at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 4
sorry is LoginStatus, do you know how to use it? I was thinking of using the logout text. Advise?
arcliner at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 5

I have not used it but now since this thread is really the focus of ASP.NET, I would have to advice you to post it over on:

http://forums.asp.net

as the entire site is dedicated to ASP.NET and someone will have a better and quicker response than here regarding ASP.NET queries :-)

ahmedilyas at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 6
Tried but there is'nt any reply.
arcliner at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 7

in that case I really don't know im afraid, im sure someone else will or again wait for a reply over on forums.asp.net

take a look at this and see if it helps, otherwise im out of ideas apart from using the way I usually use to authenticate users :-)

http://msdn2.microsoft.com/en-us/library/ms178329.aspx

ahmedilyas at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic Language...