PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

Default.aspx - add parameter

 
 
Iain
Guest
Posts: n/a
 
      5th Oct 2009
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
 
Reply With Quote
 
 
 
 
Iain
Guest
Posts: n/a
 
      5th Oct 2009
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.
 
Reply With Quote
 
Patrice
Guest
Posts: n/a
 
      5th Oct 2009
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" <(E-Mail Removed)> a écrit dans le message de groupe de discussion :
(E-Mail Removed)...
> 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



 
Reply With Quote
 
Iain
Guest
Posts: n/a
 
      5th Oct 2009
> 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

 
Reply With Quote
 
Gregory A. Beamer
Guest
Posts: n/a
 
      5th Oct 2009
Iain <(E-Mail Removed)> wrote in news:uD#(E-Mail Removed):

> 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! |
*******************************************
 
Reply With Quote
 
Iain
Guest
Posts: n/a
 
      6th Oct 2009
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!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
getting unwanted default parameter dialogs when closing parameter =?Utf-8?B?Y3l0b2dpcmw=?= Microsoft Access Forms 1 28th Mar 2007 02:47 AM
Why is Default.aspx not present in the Default Content page? Gaetan Microsoft ASP .NET 3 14th Feb 2006 07:24 PM
Q: it goes to default.aspx =?Utf-8?B?SklNLkgu?= Microsoft ASP .NET 4 7th Apr 2005 08:58 PM
default.aspx =?Utf-8?B?cm9kY2hhcg==?= Microsoft ASP .NET 2 11th Oct 2004 03:27 AM
WebForm1.aspx / default.aspx Ted Apollo Microsoft ASP .NET 5 26th Aug 2004 11:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:53 AM.