How to do this in ASP.Net 2.0 ?

Discussion in 'ASP .Net' started by Luqman, Feb 17, 2006.

  1. Luqman

    Luqman Guest

    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
    Luqman, Feb 17, 2006
    #1
    1. Advertising

  2. 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

    --
    http://www.openmymind.net/



    "Luqman" <> wrote in message
    news:...
    >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
    >
    >
    Karl Seguin [MVP], Feb 17, 2006
    #2
    1. Advertising

  3. Luqman

    clintonG Guest

    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/



    "Luqman" <> wrote in message
    news:...
    >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
    >
    >
    clintonG, Feb 17, 2006
    #3
  4. Luqman

    Bruce Barker Guest

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

    -- bruce (sqlwork.com)

    "clintonG" <> wrote in message
    news:ODd6pm%...
    > 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/
    >
    >
    >
    > "Luqman" <> wrote in message
    > news:...
    >>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
    >>
    >>

    >
    >
    Bruce Barker, Feb 17, 2006
    #4
  5. Luqman

    clintonG Guest

    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

    "Bruce Barker" <> wrote in message
    news:%23PFRbv%...
    > one cavet, many personal firewalls, or proxy servers strip the
    > HTTP_REFERER tag
    >
    > -- bruce (sqlwork.com)
    >
    > "clintonG" <> wrote in message
    > news:ODd6pm%...
    >> 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/
    >>
    >>
    >>
    >> "Luqman" <> wrote in message
    >> news:...
    >>>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
    >>>
    >>>

    >>
    >>

    >
    >
    clintonG, Feb 18, 2006
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andy Elmhorst
    Replies:
    2
    Views:
    480
    Bassel Tabbara [MSFT]
    Jul 8, 2003
  2. dave
    Replies:
    0
    Views:
    1,267
  3. Ben
    Replies:
    3
    Views:
    1,124
  4. Andrea Raimondi
    Replies:
    1
    Views:
    448
  5. Amelyan
    Replies:
    2
    Views:
    140
    Amelyan
    Apr 25, 2005
Loading...

Share This Page