Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Stick with page if code fails?


Message #1 by "Phil Bradwell" <p.bradwell@b...> on Tue, 23 Apr 2002 21:26:03 +0100
Message:  Can someone please help me with my code below. I want it to check
authentication on my login page and if not logged in or no cookies etc.. I
want it to show the page the code is currently on..
Obviously Ive found out respond.end is not the solution.. as the html does
appear and using response.redirect "home.asp" just creats a circular code..
arhhhhh

Please help.. many thanks


<%if Session("StrLoginStatus")=0 then
Call ChkCookies
end if
     if ChkCookies=0 then
     response.end
     else
     Call ChkUser
end if
select case ChkUser
     case 0
Response.end
     case 1,2,3,4,5
     Response.redirect("welcome.asp")
     end select
     %>


Message #2 by "Tony DiNucci" <tony@m...> on Tue, 23 Apr 2002 23:18:17
I'm not 100% sure if i understand your question correctly.
I am taking it that you want the login page to be redisplayed if login 
details are incorrect??

to do this just use your current page that checks details but include a 
procedure something like that below which is called when incorrect details 
are entered :

<%
' Show the Login Page
sub showLogin
 %>
 <!-- #include file="login.asp" -->
 <%
 response.end
end sub
%>

this will then show the login page when the details are incorrect and you 
can pass any variable to it you would like.......say tell them if it is 
either their username or password which is incorrect

hope this is what you meant 

  Return to Index