473,398 Members | 2,393 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Building a URL w/querystring variables

Hi everyone,

I'm noodling over the best way to construct a URL with a new querystring
variable. Let's say I want to take my existing page's URL and append a new
variable with accompanying value, then redirect, but I don't know up front
whether the URL already has any variables defined. Is there a good way of
doing this besides testing for the presence of a "?" in the URL string?

As a cherry on top and a side note it'd be nice to know too if the variable
I'm appending is already part of the URL.

Thanks very much for your help!
Aug 4 '06 #1
2 1442
You can use the QueryStringParameter class to easily extract portions of the
QueryString.
However, I don't know of any similar built-in technique for building
QueryStrings.

Here's more info:
http://windowssdk.msdn.microsoft.com...parameter.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Steve Hershoff" <ba******@nowhere.comwrote in message
news:Oa**************@TK2MSFTNGP04.phx.gbl...
Hi everyone,

I'm noodling over the best way to construct a URL with a new querystring
variable. Let's say I want to take my existing page's URL and append a
new variable with accompanying value, then redirect, but I don't know up
front whether the URL already has any variables defined. Is there a good
way of doing this besides testing for the presence of a "?" in the URL
string?

As a cherry on top and a side note it'd be nice to know too if the
variable I'm appending is already part of the URL.

Thanks very much for your help!

Aug 4 '06 #2
Loop through the items in the Request.QueryString collection and test to see
if they match your criteria or if there even is any items. That should give
you what you want.

--
-Demetri
"Steve Hershoff" wrote:
Hi everyone,

I'm noodling over the best way to construct a URL with a new querystring
variable. Let's say I want to take my existing page's URL and append a new
variable with accompanying value, then redirect, but I don't know up front
whether the URL already has any variables defined. Is there a good way of
doing this besides testing for the presence of a "?" in the URL string?

As a cherry on top and a side note it'd be nice to know too if the variable
I'm appending is already part of the URL.

Thanks very much for your help!
Aug 4 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Max | last post by:
Hello. This is the first time I've posted to a newsgroup, and I do this because I'm in desperate need of help. I'm working a user management system, and when I activate a user that has registered...
1
by: lion | last post by:
my Problem: a query string passed into a html page doesn't display correctly on a mac I am just using html and javascript (no ASP, PHP or server side scripting) This is the query string:...
5
by: Mike | last post by:
Is it possible to loop round all querystring parameters in a web page (i.e. access them without hardcoding them)? I want to do this because I have a page that has different querystring variables...
5
by: CharlesA | last post by:
Hi folks, I'm having a discussion with my colleague about how to go about passing data from one aspx page to another example On the main page I have a whole list of relationship managers with a...
2
by: Adam Knight | last post by:
Hi all, In my webforms i am building urls in the following way. <a href="#" onClick="OpenWindow('Document.aspx?action=edit&aid=<%=intAreaID%>&did=<%#...
5
by: Me | last post by:
I was wondering if after parsing Querystring, I could initialize it. Is it possible? Thank you, -Me
5
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hello to all, I have a page ASPX that calls to another one. It does window.open to another URL, and I want to hide the URL because the user not must see the querystring by security subjects. ...
0
by: bharathreddy | last post by:
Here I will given an example on how to access the session, application and querystring variables in an .cs class file. Using System.Web.HttpContext class. 1) For accesing session variables :...
4
by: .nLL | last post by:
Hi, im am a classic asp developer and started to learn asp.net but got stuck with a simple problem even before i step in to further. to learn i have started from a simple project (a login system...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.