0

My url with query string is:

http://testpage.aspx?PHONENUMBER=9991234567&CALLBACK_REASON=1st Attempt - First Contact for FNOL

i'm trying to get values as:

PHONENUMBER= (this.Request["PHONENUMBER"] == null) ? "-" : this.Request["PHONENUMBER"];

CALLBACK_REASON = (this.Request["CALLBACK_REASON"] == null) ? string.Empty : this.Request["CALLBACK_REASON"];

Here i'm unable to get CALLBACK_REASON values. Any help would be grt.

6
  • Unable to get CALLBACK_REASON? Does it throw an exception, do you get no value, do you get an incorrect value? You need to give more detail...
    – Chris
    Commented Jun 3, 2013 at 10:33
  • "1st Attempt - First Contact for FNOL" this is the value dat i get in url. I need to get this value but as if nw i'm getting nothing ie "". Commented Jun 3, 2013 at 10:36
  • What value do you get for PHONENUMBER? Commented Jun 3, 2013 at 10:54
  • i'm able to get PHONENUMBER=9991234567 similarly i need to get CALLBACK_REASON=1st Attempt - First Contact for FNOL. Commented Jun 3, 2013 at 12:23
  • i'm getting dat url from third party !!! so can it be done without encoding??? Commented Jun 3, 2013 at 12:27

2 Answers 2

1

Encode the values you put in the URI.

0
0

You need to generate a URL with the spaces encoded (it will have to look like this):

http://testpage.aspx?PHONENUMBER=9991234567&CALLBACK_REASON=1st%20Attempt%20-%20First%20Contact%20for%20FNOL

Then to read back the values, simply use this code...

PHONENUMBER= (String.IsNullOrEmpty(this.Request["PHONENUMBER"]) ? "-" : Server.UrlDecode(this.Request["PHONENUMBER"]);

CALLBACK_REASON = (String.IsNullOrEmpty(this.Request["CALLBACK_REASON"]) ? string.Empty : Server.UrlDecode(this.Request["CALLBACK_REASON"]);

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.