Passing Value on URL

Discussion in 'ASP .Net' started by - Steve -, Jun 19, 2004.

  1. - Steve -

    - Steve - Guest

    I can't find the answer to this because I don't know what it's called.

    I want to e-mail my users a link that is customized to them. For example I
    want them to click on the link and have the E-mail Textbox already filled
    out with their e-mail address.

    So I believe I want to send them a URL that looks something like
    http://site.com/page.aspx?Email=.

    How do I grab that e-mail address in my ASP.NET page though?

    --

    Steve Evans
    Email Services
    SDSU Foundation
    (619) 594-0708
     
    - Steve -, Jun 19, 2004
    #1
    1. Advertising

  2. The variables contained in a URL are called querystring variables. You can
    access it using the Request.Querystring collection. In C# it would be like:

    string strEmail = Request.QueryString["Email"].ToString();

    To guarantee success though, you'll need to test for the querystring
    variable being null like so:

    stirng strEmail = "";
    if(Request.QueryString["Email"] != null)
    {
    strEmail = Request.QueryString["Email"].ToString();
    }

    Hope this helps
    Mark Fitzpatrick
    Microsoft MVP - FrontPage

    "- Steve -" <> wrote in message
    news:...
    > I can't find the answer to this because I don't know what it's called.
    >
    > I want to e-mail my users a link that is customized to them. For example

    I
    > want them to click on the link and have the E-mail Textbox already filled
    > out with their e-mail address.
    >
    > So I believe I want to send them a URL that looks something like
    > http://site.com/page.aspx?Email=.
    >
    > How do I grab that e-mail address in my ASP.NET page though?
    >
    > --
    >
    > Steve Evans
    > Email Services
    > SDSU Foundation
    > (619) 594-0708
    >
    >
    >
     
    Mark Fitzpatrick, Jun 19, 2004
    #2
    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. Jon paugh
    Replies:
    1
    Views:
    755
  2. cc dd via .NET 247
    Replies:
    1
    Views:
    426
    GrantMagic
    Sep 23, 2004
  3. Victor Bazarov
    Replies:
    25
    Views:
    892
    E. Robert Tisdale
    Mar 23, 2005
  4. Just D.
    Replies:
    0
    Views:
    444
    Just D.
    Aug 11, 2004
  5. Tim Fröglich

    Getting ID, calling url, search for value, return value

    Tim Fröglich, Jan 7, 2006, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    144
    Josh Twist
    Jan 10, 2006
Loading...

Share This Page