PDA

View Full Version : Hide the information for guest


Ahmult
10-15-2005, 04:26 PM
If i dont want to show the guest the information of my website, what should I have to do? Do I only need to use this code for every page for my site?

<%

If Request.Form("login") = "Guest" AND Request.Form("password") = "Guest" Then
Response.Write "This is all the <B>cool stuff</B> we are trying to protect!"
Else
Response.Write "Access Denied!"
'Response.End
End If
%>

Freon22
10-15-2005, 05:53 PM
<%
If Request.Form("login") = "Guest" AND Request.Form("password") = "Guest" Then
Response.Write "This is all the <B>cool stuff</B> we are trying to protect!"
Else
Response.Write "Access Denied!"
'Response.End
End If
%>
What you could do, is after they pass your login page. Set a session for them then just put this code at the top of each page that you don't want just anyone seeing. If they don't have a session it sends them back to the login page and the same if their session timesout.

If Session("UserGood") = False or IsNull(Session("UserGood")) = True then
'Redirect to login page
Response.Redirect"login.asp"
End If

Bullschmidt
10-17-2005, 05:36 AM
And for another implementation of the same concept:

Classic ASP Design Tips - Login Page
http://www.bullschmidt.com/devtip-loginpage.asp