Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: RES: How to avoid direct access


Message #1 by =?iso-8859-1?Q?Maur=EDcio_Guimar=E3es?= <mandrade@o...> on Wed, 12 Dec 2001 17:45:53 -0200
Hi,



Well, you could place some code in your "Session_OnStart" Event. Something

like this:



Sub Session_OnStart

'Assuming your start page is "default.asp"

	If Request.ServerVariables("SCRIPT_NAME") <> "default.asp" Then

		Response.Redirect "default.asp"

	End If

End Sub



To force subsequent tries to be redirected to your page, you could check

some hidden parameter from your forms (which you can find at

"Request.Form("valuename")" if you use METHOD=POST or

Request.QueryString("valuename")" if you use METHOD=GET; if this value is

"", it means the user tried to access your page outside your form, then you

redirect the user to your main page...



Hope This Helps



Mauricio



-----Mensagem original-----

De: andre.scaldaferri@c... [mailto:andre.scaldaferri@c...]

Enviada em: quarta-feira, 12 de dezembro de 2001 14:21

Para: ASP Web HowTo

Assunto: [asp_web_howto] How to avoid direct access





Hello guys.



I'm a newbie on web development and I found a problem.



I have some queries on my site, that change data using forms, but if the

guy acess some pages directly, I got an error.



How could I "force" the users to acess my pages only by the main page?





TIA and Best Regards



Andre




$subst('Email.Unsub').




  Return to Index