Default.aspx - add parameter

Discussion in 'ASP .Net' started by Iain, Oct 5, 2009.

  1. Iain

    Iain Guest

    All,

    Simple question, on the loading of default.aspx how do I add a
    parameter(s) to the url string, for example :

    http://localhost/webapp/default.aspx?id=1

    The page default.aspx is my start page.

    Regards
    Iain
     
    Iain, Oct 5, 2009
    #1
    1. Advertising

  2. Iain

    Iain Guest

    Mark Rae [MVP] wrote:

    > Do you mean that you want to take the URL of the current page and then
    > redirect to somewhere else with extra parameters...?
    >
    > Or, are you talking about URL rewriting...?
    >
    > Can you clarify, please...? By far the simplest thing will be to tell
    > the group what you're trying to do...
    >
    >

    URL rewriting, sounds like it's not possible, if I've read it correctly
    you can only add a parameter to a page when you redirect to a different
    page?

    What I am trying to achieve is retrieve a value from the default.aspx
    url which is my start page.
     
    Iain, Oct 5, 2009
    #2
    1. Advertising

  3. Iain

    Patrice Guest

    If you have no id querystring then act as if you had an id with the value 1
    (basically have an id private member that has a default value of 1 and that
    takes Request.QueryString("id") if available, then use id in your page. As a
    result you'll use 1 if no id is given, the given id if one is given...

    My understanding is that default.aspx is your default page and that would
    you likely this page act as default.aspx?id=1 rather than just default.aspx
    when someone first hit your site...

    --
    Patrice

    "Iain" <> a écrit dans le message de groupe de discussion :
    ...
    > All,
    >
    > Simple question, on the loading of default.aspx how do I add a
    > parameter(s) to the url string, for example :
    >
    > http://localhost/webapp/default.aspx?id=1
    >
    > The page default.aspx is my start page.
    >
    > Regards
    > Iain
     
    Patrice, Oct 5, 2009
    #3
  4. Iain

    Iain Guest

    > If you want people to enter an id, then they'll have to do so explicitly
    > e.g. http://www.mysite.com/default.aspx?id=25
    >
    > Is that what you mean...?
    >
    > If not, then my apologies but you're not making yourself clear...
    >
    >

    Sorry if I am not explaining myself clearly.

    When I start my website (from within Visual Studio), once VS has loaded
    my web page, instead of the url address containing :

    http://localhost/webapp/default.aspx

    I would like to append to the end of the url the value ?id=10, producing
    the initial url :

    http://localhost/webapp/default.aspx?id=10
     
    Iain, Oct 5, 2009
    #4
  5. Iain <> wrote in news:uD#:

    > URL rewriting, sounds like it's not possible, if I've read it correctly
    > you can only add a parameter to a page when you redirect to a different
    > page?


    It is possible. In .NET 3.0 and earlier, you can do it with an HTTP
    Handler. With 3.5 SP1, you can use the URL routing feature. It is still
    redirecting, but it is server side.

    Peace and Grace,

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

    Twitter: @gbworld
    Blog: http://gregorybeamer.spaces.live.com

    *******************************************
    | Think outside the box! |
    *******************************************
     
    Gregory A. Beamer, Oct 5, 2009
    #5
  6. Iain

    Iain Guest

    Mark Rae [MVP] wrote:
    >
    > Aha...
    >
    > 1) Right-click on the project name in the Solution and select Project
    >
    > 2) Select the Web tab
    >
    > 3) Modify the Start URL accordingly.
    >
    >


    Cheers, exactly what I wanted!
     
    Iain, Oct 6, 2009
    #6
    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. Ted Apollo

    WebForm1.aspx / default.aspx

    Ted Apollo, Aug 26, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    2,407
    Joerg Jooss
    Aug 26, 2004
  2. John M
    Replies:
    1
    Views:
    1,178
    Kumar Reddi
    May 29, 2005
  3. Gaetan
    Replies:
    3
    Views:
    1,432
    Juan T. Llibre
    Feb 14, 2006
  4. Stuart Redmann
    Replies:
    5
    Views:
    481
    Stuart Redmann
    Dec 14, 2007
  5. ColdAir
    Replies:
    1
    Views:
    785
    JeffP->
    Feb 26, 2009
Loading...

Share This Page