473,441 Members | 1,941 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,441 software developers and data experts.

Removing a Request variable

I set ndi in a repost of a page:

window.location.href=
'../Test/test.aspx' +
'?ndi=' +
theform.domain_SELECT.options.selectedIndex;

In the test.aspx.cs code-behind, I test if ndi is set as

if ( Request [ "ndi" ] != null )

How can I cause ndi to become null once that I've tested it and found it
existed? A Session variable is cleared by Session.Contents.Remove. Is there
an equivalent for a Request variable?

TIA

--
Gus Gustafson
Nov 17 '05 #1
2 1469
Hi Gus,

I think the querystring name value collection of the HttpRequest object
is read only.

I'm a little puzzled why you might need this functionality? When needing
a querystring value, you might want to use a variable, especially as the
ndi variable is actually an integer.

int ndi = -1; //no ndi value selected

if (Request["ndi"] != null && Request["ndi"] != String.Empty)
{
ndi = Int32.Parse(Request["ndi"]);
}
if (ndi > -1)
{
Debug.WriteLine("We have a ndi value!");
}

Ward

Gus Gustafson wrote:
I set ndi in a repost of a page:

window.location.href=
'../Test/test.aspx' +
'?ndi=' +
theform.domain_SELECT.options.selectedIndex;

In the test.aspx.cs code-behind, I test if ndi is set as

if ( Request [ "ndi" ] != null )

How can I cause ndi to become null once that I've tested it and found it
existed? A Session variable is cleared by Session.Contents.Remove. Is there
an equivalent for a Request variable?

TIA

Nov 17 '05 #2
Ward, of course you are right in your questioning motive. Last night I
realized that the only time I needed to test ndi was in the case ! PostBack.
That saves trying to clear a read-only variable.

Thanks for reminding me about the String.Empty test.

Thanks for your thoughts.

--
Gus Gustafson
"wbekker" wrote:
Hi Gus,

I think the querystring name value collection of the HttpRequest object
is read only.

I'm a little puzzled why you might need this functionality? When needing
a querystring value, you might want to use a variable, especially as the
ndi variable is actually an integer.

int ndi = -1; //no ndi value selected

if (Request["ndi"] != null && Request["ndi"] != String.Empty)
{
ndi = Int32.Parse(Request["ndi"]);
}
if (ndi > -1)
{
Debug.WriteLine("We have a ndi value!");
}

Ward

Gus Gustafson wrote:
I set ndi in a repost of a page:

window.location.href=
'../Test/test.aspx' +
'?ndi=' +
theform.domain_SELECT.options.selectedIndex;

In the test.aspx.cs code-behind, I test if ndi is set as

if ( Request [ "ndi" ] != null )

How can I cause ndi to become null once that I've tested it and found it
existed? A Session variable is cleared by Session.Contents.Remove. Is there
an equivalent for a Request variable?

TIA

Nov 17 '05 #3

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

Similar topics

0
by: J. Muenchbourg | last post by:
I'm cannot seem to get my request objects posted from a form on a previous page to show up on the page I'm posting to. When I try it locally on my IIS webserver, it works fine. But the form posting...
1
by: Phil Amey | last post by:
In a web based form I am able to make sure that there is text in an input field but I want to restrict the user from using such characters as ~ # & ' How can I modify this JavaScript below to...
66
by: Cor | last post by:
Hi, I start a new thread about a discussion from yesterday (or for some of us this morning). It was a not so nice discussion about dynamically removing controls from a panel or what ever. It...
2
by: Milsnips | last post by:
hi there, i have the following HTML code: -------------------------- <asp:DropDownList id="hddList" runat="server"> <asp:ListItem Value="1">Item 1</asp:ListItem> <asp:ListItem Value="2">Item...
3
by: Nathan Sokalski | last post by:
I am having trouble removing cookies that I created with my site. Here is the code I am using to try and remove them: If Not Request.Cookies("username") Is Nothing Then...
6
by: saif.shakeel | last post by:
Hi, Suppose i have a string stored in variable,how do i remove the space between them,like if i have the name: "USDT request" in a variable.i need "USDTrequest",without any space . Thanks
5
by: chromis | last post by:
Hi there, I've recently been updating a site to use locking on application level variables, and I am trying to use a commonly used method which copies the application struct into the request...
7
by: ADN | last post by:
Hi, I am creating a custom HTTPModule to intercept the request of when the user is attempting to retrieve a session variable. For instance, if I set a session variable in my code like so: ...
14
by: doublestack | last post by:
I am calling a variable from an aspx page (LOGON_USER) into a url and need to remove the special character "\" so the user can be logged in correctly. I am using: <script...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.