How to control Url access in asp.net

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?UGF0cmljay5PIC5JZ2U=?=

    How to control Url access in asp.net

    Hi guys,
    I want users to complete a webform or edit a page before getting to
    a specific page.
    The pages need to do the following:
    1)Check to see if they need to edit or complete a form if YES then until
    they complete it they can get to a specific page or URL. If not i sent them
    to the page they need to get to
    2)But the thing is if a user is smart they can copy the url and paste it
    directly.
    And if they do that i want to throw them out .
    How can i let a user get to the url unless they have done what i wanted.
    Thanks in advance
  • Mark Rae [MVP]

    #2
    Re: How to control Url access in asp.net

    "Patrick.O .Ige" <PatrickOIge@di scussions.micro soft.comwrote in message
    news:7EADDAE7-5FBE-4271-B455-164D8872D216@mi crosoft.com...
    I want users to complete a webform or edit a page before getting to
    a specific page.
    The pages need to do the following:
    1)Check to see if they need to edit or complete a form if YES then until
    they complete it they can get to a specific page or URL. If not i sent
    them
    to the page they need to get to
    2)But the thing is if a user is smart they can copy the url and paste it
    directly.
    And if they do that i want to throw them out .
    How can i let a user get to the url unless they have done what i wanted.
    Several ways, probably...

    However, an extremely simple way would be to use a Session variable.

    When a user first accesses the site (or logs in...) set a Session variable
    e.g.

    Session["CanProceed "] = false;

    Then, once the user has done what you want, set the Session variable to
    true;

    On any page which they shouldn't access unless they have done what you want,
    simply check the value of the Session variable, e.g.

    protected Page_Init (object sender, EventArgs e)
    {
    if (!(bool)Session["CanProceed "])
    {
    Response.Redire ct(MyOtherPage. aspx, false);
    }
    }


    --
    Mark Rae
    ASP.NET MVP


    Comment

    • =?Utf-8?B?UGF0cmljay5PIC5JZ2U=?=

      #3
      Re: How to control Url access in asp.net

      Thanks Mark.
      Taught of that already.Thinkin g of doing some flagging in the DB


      "Mark Rae [MVP]" wrote:
      "Patrick.O .Ige" <PatrickOIge@di scussions.micro soft.comwrote in message
      news:7EADDAE7-5FBE-4271-B455-164D8872D216@mi crosoft.com...
      >
      I want users to complete a webform or edit a page before getting to
      a specific page.
      The pages need to do the following:
      1)Check to see if they need to edit or complete a form if YES then until
      they complete it they can get to a specific page or URL. If not i sent
      them
      to the page they need to get to
      2)But the thing is if a user is smart they can copy the url and paste it
      directly.
      And if they do that i want to throw them out .
      How can i let a user get to the url unless they have done what i wanted.
      >
      Several ways, probably...
      >
      However, an extremely simple way would be to use a Session variable.
      >
      When a user first accesses the site (or logs in...) set a Session variable
      e.g.
      >
      Session["CanProceed "] = false;
      >
      Then, once the user has done what you want, set the Session variable to
      true;
      >
      On any page which they shouldn't access unless they have done what you want,
      simply check the value of the Session variable, e.g.
      >
      protected Page_Init (object sender, EventArgs e)
      {
      if (!(bool)Session["CanProceed "])
      {
      Response.Redire ct(MyOtherPage. aspx, false);
      }
      }
      >
      >
      --
      Mark Rae
      ASP.NET MVP

      >
      >

      Comment

      • Mark Rae [MVP]

        #4
        Re: How to control Url access in asp.net

        "Patrick.O .Ige" <PatrickOIge@di scussions.micro soft.comwrote in message
        news:B6C8E811-A337-471E-98D6-967C58AD267D@mi crosoft.com...

        [top-posting corrected]
        >>How can i let a user get to the url unless they have done what i
        >>wanted.
        >>
        >Several ways, probably...
        >>
        >However, an extremely simple way would be to use a Session variable.
        >
        Thought of that already.Thinkin g of doing some flagging in the DB
        Like I said, there will be several ways of doing this. However, simplest is
        often the best...


        --
        Mark Rae
        ASP.NET MVP


        Comment

        Working...