HttpRequest parameter read

Discussion in 'ASP .Net' started by MuZZy, Apr 17, 2004.

  1. MuZZy

    MuZZy Guest

    Hello,

    I am developing a web application. If i call an aspx page with several
    parameters, is there a way to get access to parameter values by key? I am
    using C#

    E.g.

    void PageLoad(object sender, EventArgs e) {
    string album = Request.<???>("album");
    }

    And a call the page: http://mywebsite.com/pics.aspx?album=FirstAlbum.

    As i could see, it only provides methods to get a list of parameters and
    then loop thru them.
    Is there any direct way?

    PS Sorry for cross-posting, i wasn't sure either to post the question to C#
    or ASP.NET NG.

    Thank you,
    Andrey
     
    MuZZy, Apr 17, 2004
    #1
    1. Advertisements

  2. MuZZy

    Guest Guest

    String album = Request.QueryString["album"];

    havent tried this, but should work

    Kalpesh
     
    Guest, Apr 17, 2004
    #2
    1. Advertisements

  3. "MuZZy" <> wrote in
    news:tw3gc.9650$0b4.20257@attbi_s51:

    > Hello,
    >
    > I am developing a web application. If i call an aspx page with
    > several parameters, is there a way to get access to parameter
    > values by key? I am using C#
    >
    > E.g.
    >
    > void PageLoad(object sender, EventArgs e) {
    > string album = Request.<???>("album");
    > }
    >
    > And a call the page:
    > http://mywebsite.com/pics.aspx?album=FirstAlbum.
    >
    > As i could see, it only provides methods to get a list of
    > parameters and then loop thru them.
    > Is there any direct way?


    Andrey,

    string album = string.Empty;
    if (Request.Params["album"] != null)
    album = Request.Params["album"].ToString();


    Hope this helps.

    Chris.
    -------------
    C.R. Timmons Consulting, Inc.
    http://www.crtimmonsinc.com/
     
    Chris R. Timmons, Apr 17, 2004
    #3
  4. string album = Request.QueryString["album"];

    --
    Manohar Kamath
    Editor, .netWire
    www.dotnetwire.com


    "MuZZy" <> wrote in message
    news:tw3gc.9650$0b4.20257@attbi_s51...
    > Hello,
    >
    > I am developing a web application. If i call an aspx page with several
    > parameters, is there a way to get access to parameter values by key? I am
    > using C#
    >
    > E.g.
    >
    > void PageLoad(object sender, EventArgs e) {
    > string album = Request.<???>("album");
    > }
    >
    > And a call the page: http://mywebsite.com/pics.aspx?album=FirstAlbum.
    >
    > As i could see, it only provides methods to get a list of parameters and
    > then loop thru them.
    > Is there any direct way?
    >
    > PS Sorry for cross-posting, i wasn't sure either to post the question to

    C#
    > or ASP.NET NG.
    >
    > Thank you,
    > Andrey
    >
    >
     
    Manohar Kamath [MVP], Apr 17, 2004
    #4
    1. Advertisements

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. Greg Reevosh via .NET 247

    HTTPRequest and JAVA Servlet

    Greg Reevosh via .NET 247, Oct 17, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    682
    Greg Reevosh via .NET 247
    Oct 17, 2004
  2. Greg Reevosh via .NET 247

    HTTPRequest and JAVA Servlet

    Greg Reevosh via .NET 247, Oct 31, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    524
    Greg Reevosh via .NET 247
    Oct 31, 2004
  3. Greg Reevosh via .NET 247

    HTTPRequest and JAVA Servlet

    Greg Reevosh via .NET 247, Jan 23, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    440
    Greg Reevosh via .NET 247
    Jan 23, 2005
  4. Mark Miller
    Replies:
    1
    Views:
    1,246
    Mark Miller
    Jul 18, 2003
  5. Dales

    Httprequest problems

    Dales, Oct 27, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    639
    Joerg Jooss
    Nov 1, 2003
  6. Rick Strahl [MVP]

    Client side HttpRequest or Call WebService.

    Rick Strahl [MVP], Oct 29, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    1,273
    Rajesh.V
    Oct 29, 2003
  7. Jim Lawton
    Replies:
    2
    Views:
    467
    Jim Lawton
    Nov 12, 2003
  8. Replies:
    0
    Views:
    1,698
Loading...