Default.aspx - add parameter

I

Iain

Mark said:
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.
 
P

Patrice

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...
 
I

Iain

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
 
G

Gregory A. Beamer

Iain said:
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,
 
I

Iain

Mark said:
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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top