How to do this in ASP.Net 2.0 ?

L

Luqman

A user should be able to access the page 2 only via Page 1.

If he tries to go to page 2 directly, unauthorised access error should
occur.

Any idea please ?

Best Regards,

Luqman
 
K

Karl Seguin [MVP]

Well, you can do it with a server.transfer

sub SomeButton_OnClick
Context.Items.Add("AccessOk", true)
Server.Transfer("page2.aspx")
end sub

page2_pageload
if Context.Items("AccessOk") is nothing then
'access denied
end if
...
end sub
 
C

clintonG

When using ASP I used to set a value for a Session variable only when
Page1.asp was loaded. Each time Page2 is loaded I would check the Session
variable -- and -- I would check the HTTP_REFERER Server variable when Page2
loads. If both variables were empty I would redirect somewhere. If not Page2
could be used.

Using the Session variable ensured me that at least Page1 was being viewed.
The HTTP_REFERER value ensured me that a click event in Page1 was used to
request Page2.

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://clintongallagher.metromilwaukee.com/
 
B

Bruce Barker

one cavet, many personal firewalls, or proxy servers strip the HTTP_REFERER
tag

-- bruce (sqlwork.com)
 
C

clintonG

Yea I know but thanks for pointing it out for others. I did a whole survey
of this variable to determine how to use it but never "blogged" on it.
Basically I learned this variable comes from the Johnny Cocharan School of
Web Development. "If there is no click you can not commit!" :)

I'll tell ya something you could comment on if you wish...
I'm using a 2.0 Wizard Control to generate XML. I need to output the XML to
display -- and -- the file system -- and -- I also want to shred it into
SQL2005 which in the order of operations should I assume be done last. I do
all the XmlWriter operations in the Wizard control's click event handler.
Besides the native support now available in SQL2005 what technique would you
use to shred the XML into SQL2005?

<%= Clinton Gallagher
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top