10

I want to pass an empty string parameter in a url. I don't know how to do it.

I am passing these parameters in the url for a grid. In the database if I using Race=''. I get the respective records. I need to pass this in the url

test.aspx?race=""

3 Answers 3

13

The url would look like this:

text.aspx?race=

or

text.aspx?race=&otherParam=value&etc=otherValue

Then you would have code to handle race being empty:

if(string.IsNullOrEmpty(Request.QueryString["race"]))
// handle the empty race differently
Sign up to request clarification or add additional context in comments.

1 Comment

Modsecurity will not like this. It wants to see something between = and &, or it will flag it as an attack attempt.
4

You can pass an empty string in url like this

test.aspx?race=%02%03

%02 - start of text ASCII Character

%03 - end of text ASCII Character

In this page you can find other characters too.

1 Comment

Interesting. However, AFAIK, URL spec does not define any special behavior for those two characters. Your linked page says "Control characters have nothing to do inside a URL." Given that, I see only two possibities: a) those characters are discarded from the value, in which case this is "overkill"; why not just use earlier answer test.aspx?race=? OR b) those characters are included w/i the value, in which case you would need special logic to look for that string of two characters - seems undesireable. I have not tested, but I believe "(b)" is what happens.
1
Dim race As String

race = ""

Response.Redirect("page.aspx?race=" & race)

Is this what you want??

2 Comments

I am trying to pull out records from the data base where the field race is blank (Select * from tbltest where race=''). I want to know how will I pass the balnk parameter in a query.string or URL to a grid
It kind of does answer the question, though it's a bit vague about it - the correct answer is that the URL should be text.aspx?race=.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.