Newbie: Request

Discussion in 'ASP .Net' started by Scott, Feb 19, 2009.

  1. Scott

    Scott Guest

    Hi,
    I am still learning ASP, and having an issue.
    Suppose I have 2 asp forms. Form1.aspx and Form2.aspx.
    From Form1.aspx I am calling Form2.aspx like this
    response.redirect("Form2.aspx?ID=11")

    Now from Form2.aspx I want to know from which page I am getting this request
    or which page is asking for this request. In this example it should be
    Form1.aspx.
    Is there any way doing this.

    Thanks,
    Scott
     
    Scott, Feb 19, 2009
    #1
    1. Advertising

  2. Scott wrote:
    > Hi,
    > I am still learning ASP, and having an issue.
    > Suppose I have 2 asp forms. Form1.aspx and Form2.aspx.
    > From Form1.aspx I am calling Form2.aspx like this
    > response.redirect("Form2.aspx?ID=11")
    >
    > Now from Form2.aspx I want to know from which page I am getting this request
    > or which page is asking for this request. In this example it should be
    > Form1.aspx.
    > Is there any way doing this.


    Request.UrlReferrer
    should give you the complete URL (e.g.
    http://example.com/dir/Form1.aspx) as an Uri object where can then
    extract what you are looking for.


    --

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Feb 19, 2009
    #2
    1. Advertising

  3. Just to be sure you are learning ASP.NET properly, I have a question?

    Why are you linking forms in this manner? Is it to have a multipage submit?

    If so, you are better to use a Wizard control, a set of panels, or similar
    rather than submit and pass. Then everything you need for the final submit
    sits in one page, even if the user cannot see it visibly. Much easier to
    control and more ASP.NET like.

    In classic ASP, it was quite common to have multiple forms. In ASP.NET, the
    form should encapsulate the user interface for the entire use case - at
    least in most instances.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    Blog:
    http://feeds.feedburner.com/GregoryBeamer

    *************************************************
    | Think outside the box! |
    *************************************************

    "Scott" <> wrote in message
    news:##...
    > Hi,
    > I am still learning ASP, and having an issue.
    > Suppose I have 2 asp forms. Form1.aspx and Form2.aspx.
    > From Form1.aspx I am calling Form2.aspx like this
    > response.redirect("Form2.aspx?ID=11")
    >
    > Now from Form2.aspx I want to know from which page I am getting this
    > request or which page is asking for this request. In this example it
    > should be Form1.aspx.
    > Is there any way doing this.
    >
    > Thanks,
    > Scott
    >
     
    Cowboy \(Gregory A. Beamer\), Feb 19, 2009
    #3
  4. Scott

    wjfamilia Guest

    I would recommend you look into the Wizard control.

    --
    William J. Familia


    "Mark Rae [MVP]" wrote:

    > "Scott" <> wrote in message
    > news:%23%...
    >
    > > I am still learning ASP

    >
    > In fact, you're not - you're learning ASP.NET... :)
    >
    > ASP is (generally) taken to refer to ASP Classic...
    >
    > > and having an issue.
    > > Suppose I have 2 aspx forms. Form1.aspx and Form2.aspx.
    > > From Form1.aspx I am calling Form2.aspx like this
    > > response.redirect("Form2.aspx?ID=11")
    > >
    > > Now from Form2.aspx I want to know from which page I am getting this
    > > request or which page is asking for this request. In this example it
    > > should be Form1.aspx.
    > > Is there any way doing this.

    >
    > The Request.UrlReferrer class gives information about the page from which
    > the current page was redirected.
    >
    > However, this cannot be relied upon at all, especially when running on the
    > public Internet:
    > http://www.google.co.uk/search?sour...98&q="Response.Redirect" Request.UrlReferrer"
    >
    > The only guaranteed way of doing this is by passing the name of the page
    > either as part of the Request, in the QueryString, in a Session variable
    > etc...
    >
    >
    > --
    > Mark Rae
    > ASP.NET MVP
    > http://www.markrae.net
    >
    >
     
    wjfamilia, Feb 19, 2009
    #4
    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. Steve
    Replies:
    0
    Views:
    5,348
    Steve
    Jul 1, 2003
  2. Daniel Bass
    Replies:
    2
    Views:
    3,722
    dave wanta
    Jul 4, 2003
  3. Christian H
    Replies:
    1
    Views:
    887
    Natty Gur
    Jul 29, 2003
  4. Brian Birtle
    Replies:
    2
    Views:
    2,073
    John Saunders
    Oct 16, 2003
  5. George
    Replies:
    5
    Views:
    6,631
    George
    Apr 2, 2004
Loading...

Share This Page