Patrick Olurotimi Ige <ig*@iprimus.com.au> confessed in news:
#K**************@TK2MSFTNGP11.phx.gbl:
Is it possible to execute a query or do some validation before loading a
page..
I have a survey page and i want to validate users before loading the
page.
I have done it in the page_load.
But the problem i have is that if the user gets the URL and directly
paste it to the browser the USER still sees the page.
Is there a way how to check the user in the DB before loading the page
(I mean just by pasting the URL to the browser or just by clicking the
IE browser?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Yes, you use dotnet's authentication and authorization features.
You need a statement like this in your Web.config:
<system.web>
<authentication mode="Forms">
<forms name="LoginForm" loginUrl="Login.aspx" />
</authentication>
</system.web>
and another to setup authorization:
<location path="YourFile.aspx">
<system.web>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</location>
the deny users=? means that only authenticated users have access to the
file. Anonymous users will be redirected to your login page.
-- ipgrunt