Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Request (Reference to) other page

Request (Reference to) other page

Scheduled Pinned Locked Moved Visual Basic
csharpasp-netcomhelp
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Aizupis
    wrote on last edited by
    #1

    I just started using WebMatrix and ASP.NET, and I have one problem - I like to know, how I can do it: Situation - I have one page "Licence agreement" with Agree and Disagree; when user click Agree, then must open Registration form (I made it in that way: Response.Redirect("Reg.aspx")). So far is OK! But I need, that the form Reg.aspx opens only when in Licence form users click Agree - shortly - it (Reg) should no opens, when users write in adress bar http://www.xxxxx.com/Reg.aspx... Sorry for my english, but I hope that U understood my problem. I use VB.NET

    D 1 Reply Last reply
    0
    • A Aizupis

      I just started using WebMatrix and ASP.NET, and I have one problem - I like to know, how I can do it: Situation - I have one page "Licence agreement" with Agree and Disagree; when user click Agree, then must open Registration form (I made it in that way: Response.Redirect("Reg.aspx")). So far is OK! But I need, that the form Reg.aspx opens only when in Licence form users click Agree - shortly - it (Reg) should no opens, when users write in adress bar http://www.xxxxx.com/Reg.aspx... Sorry for my english, but I hope that U understood my problem. I use VB.NET

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Why not have them on the same page and skip the Agree/Disagree buttons. Put into your License Agreement that submitting a registration automatically agrees with license? But, you could drop a small flag into the Session object, in the Agree button click event, that is read by the Reg.aspx Page_Load event. In there, if the flag is not set, redirect them back to the License page. In your License page AgreeButton_Click handler:

      Session("License") = "Accepted"
      

      And in your Registration Page_Load event handler:

      If Session("License") <> "Accepted" Then
          Response.Redirect("...URL to License Page...")
      End If
      

      RageInTheMachine9532

      M 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Why not have them on the same page and skip the Agree/Disagree buttons. Put into your License Agreement that submitting a registration automatically agrees with license? But, you could drop a small flag into the Session object, in the Agree button click event, that is read by the Reg.aspx Page_Load event. In there, if the flag is not set, redirect them back to the License page. In your License page AgreeButton_Click handler:

        Session("License") = "Accepted"
        

        And in your Registration Page_Load event handler:

        If Session("License") <> "Accepted" Then
            Response.Redirect("...URL to License Page...")
        End If
        

        RageInTheMachine9532

        M Offline
        M Offline
        Michael Flanakin
        wrote on last edited by
        #3

        I don't think using a session variable would be the best solution. I would do one of two things: (1) Check the page the user came from

        If Request.ServerVariables("http_referer") <> "LicensePage.aspx" Then
        ' send user to another page or show an error
        End If

        Or... (2) Show/Hide panels upon agree/disagree
        Within your ASPX page:

        <asp:Panel id="LicensePanel" runat="server">
        ...
        <asp:Button id="AgreeButton" Text="Agree" runat="server" />
        <asp:Button id="DisagreeButton" Text="Disagree" runat="server" />
        </asp:Panel">

        <asp:Panel id="AgreePanel" Visible="false" runat="server">
        You agreed! :)
        </asp:Panel">

        <asp:Panel id="DisagreePanel" Visible="false" runat="server">
        You disagreed! :(
        </asp:Panel">

        And, within your AgreeButton_Click:

        LicensePanel.Visible = False
        AgreePanel.Visible = True

        And, finally, within your DisagreeButton_Click:

        LicensePanel.Visible = False
        DisagreePanel.Visible = True

        Now, personally, I'd prefer the second option over the first, but that kind of depends on how much functionality you want on the page. I'll leave that up to you. Hope this helps! Michael Flanakin Web Log

        D 1 Reply Last reply
        0
        • M Michael Flanakin

          I don't think using a session variable would be the best solution. I would do one of two things: (1) Check the page the user came from

          If Request.ServerVariables("http_referer") <> "LicensePage.aspx" Then
          ' send user to another page or show an error
          End If

          Or... (2) Show/Hide panels upon agree/disagree
          Within your ASPX page:

          <asp:Panel id="LicensePanel" runat="server">
          ...
          <asp:Button id="AgreeButton" Text="Agree" runat="server" />
          <asp:Button id="DisagreeButton" Text="Disagree" runat="server" />
          </asp:Panel">

          <asp:Panel id="AgreePanel" Visible="false" runat="server">
          You agreed! :)
          </asp:Panel">

          <asp:Panel id="DisagreePanel" Visible="false" runat="server">
          You disagreed! :(
          </asp:Panel">

          And, within your AgreeButton_Click:

          LicensePanel.Visible = False
          AgreePanel.Visible = True

          And, finally, within your DisagreeButton_Click:

          LicensePanel.Visible = False
          DisagreePanel.Visible = True

          Now, personally, I'd prefer the second option over the first, but that kind of depends on how much functionality you want on the page. I'll leave that up to you. Hope this helps! Michael Flanakin Web Log

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Just something off the top of my head. I haven't been doing much ASP.NET so my solution most likely isn't the best, but it works... Your solutions are much better. Thanks for the tips! :-D RageInTheMachine9532

          M 1 Reply Last reply
          0
          • D Dave Kreskowiak

            Just something off the top of my head. I haven't been doing much ASP.NET so my solution most likely isn't the best, but it works... Your solutions are much better. Thanks for the tips! :-D RageInTheMachine9532

            M Offline
            M Offline
            Michael Flanakin
            wrote on last edited by
            #5

            Both of our solutions will work just fine. Using session variables, however, could lead to scalability problems in the long run. It's best to try to avoid them as a good practice. Michael Flanakin Web Log

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups