Matar Posted April 1, 2006 Share Posted April 1, 2006 hi i face a big big big problem which is when a user login to his account and press a back button he will back to the home page after that when he press in the forward button he will back to his account so how i can prevent him from this Link to comment Share on other sites More sharing options...
SteveC Posted April 2, 2006 Share Posted April 2, 2006 hi i face a big big big problem which is when a user login to his account and press a back button he will back to the home page after that when he press in the forward button he will back to his account so how i can prevent him from this<{POST_SNAPBACK}> Why a logged in member is not allowed to do this is a little weird?I let my members run around anywhere on the site with full access, when they want to logout, i have a logout button set to a page which basically usesSession.Abandon() to release all their set session vars.If you really want them not to be able to go back, you could try putting an IF..End If in the home page that says if they are logged in to redirect back, or wherever.If they are not a member just to display the home page normally.Kinda like this...<% If UserType = "Member" Then Response.Redirect("memberarea.asp")Else %> < show page normally here ><% End If %> How you choose to store the UserType etc is up to you so i just put UserType so ya get the idea :)You may also want to make sure the home page or other pages you want to reload everytime (vs load from cache) are set to not cache. <%'Dont allow cache, or new values wont showResponse.CacheControl = "no-cache"Response.Expires = -1%> I place this code first, above the <html> start tagKeep in mind if the page never caches, every single time a request is made to show that page it will need to pull from server again and again.Hope something above works for ya Link to comment Share on other sites More sharing options...
Matar Posted April 2, 2006 Author Share Posted April 2, 2006 hi man .. thnaks for this useful replay the login i make is for students to show there marks ( my site is for my college)so , i am not very well in asp but this my code in log page :********<html><head><meta http-equiv="Content-Language" content="en-us"><meta http-equiv="Content-Type" content="text/html; charset=windows-1256"></head><body bgcolor="#BDCEE1"><center><%user=Request.form("user")pass=Request.form("pass")if user = "" then Response.Redirect("error.asp?error=name_null")elseif pass = "" thenResponse.Redirect ("error.asp?error=pass_null")end if end if Dim conn Dim rs Set Conn = Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open(Server.Mappath("/webdata/log.mdb"))set rs = Server.CreateObject("ADODB.recordset") sql= "SELECT * FROM stu WHERE user = '" & Request.Form("user") & "' and pass = '" &Request.form("pass")&"'" set RS = Conn.Execute(SQL)if rs.eof then response.Redirect ("error.asp?error=Name_Entry")elseif rs("pass") <> pass then response.Redirect ("error.asp?error=pass_Entry") end ifend if%><table border="1" width="100%"><tr><%for each x in rs.Fields%> <% if x.value <>"" then%> <%response.write("<th>" & x.name & "</th>")%> <%end if%><%next%></tr> <%do until rs.EOF%> <tr> <%for each x in rs.Fields%> <% if x.value <>"" then%> <td> <%Response.Write(x.value)&"<br/>"%></td> <%end if%> <%next rs.MoveNext%> </td> <% loopRS.CloseSet RS = nothingConn.CloseSet Conn = nothingsession.abandon%></table></center></body></html>***** if you have any useful idea to this code plz tell me about it thanks Link to comment Share on other sites More sharing options...
Matar Posted April 2, 2006 Author Share Posted April 2, 2006 i try this code in my log page but when i go back , i see the cannot found pagethe code i mean this Response.CacheControl = "no-cache"Response.Expires = -1how i can load the anthor page that describe you can't go back in fact you give a very very very useful information thank u my friend Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now