1

Updated

Looks like if folder name string contains "#" it is getting truncated in the querystring itself , i tried below but both gives me only Junli Zhuang instead of Junli Zhuang # Kangna Zeng

 Request.Url.Query
 Request.Querystring

Junli Zhuang # Kangna Zeng

code=VST5ic61HC2UhAFGBLCzp0OF5x3V4WLZMdjRH%2blY1iKVhBeHE9qwI8X%2bPGQ1fYlg0eW3VHhLu9tvUqrInf8hHQffk%2fr7IShrs70DM5ManybKon%2bjz5RTzx8vl10Yo5ahimFoecxA%2b8DAWOPUvlt%2blsDy1WXU0Yfft6ENeG%2bmX27Kj80BOfMR7J0x5oWpNXfWjj1RRPXNkFXOpPn3dfaSIMWb%2fbdN%2fjmwj5APwsw5uRA%3d&ow=False&fp=%2f4.+Junli+Zhuang


Resolved -

I have query string which looks like below -

code=VST5ic61HC2UhAFGBLCzp0OF5x3V4WLZMdjRH%2blY1iKVhBeHE9qwI8X%2bPGQ1fYlg0eW3VHhLu9tvUqrInf8hHQffk%2fr7IShrs70DM5ManybKon%2bjz5RTzx8vl10Yo5ahimFoecxA%2b8DAWOPUvlt%2blsDy1WXU0Yfft6ENeG%2bmX27Kj80BOfMR7J0x5oWpNXfWjj1RRPXNkFXOpPn3dfaSIMWb%2fbdN%2fjmwj5APwsw5uRA%3d&ow=False&fp=%2f4.+Junli+Zhuang+&+Kangna+Zeng

I am reading the value of "fp" like below -
 string uploadDirectoryStructure = context.Request.QueryString["fp"].ToString()

it gives me - 4. Junli Zhuang 

but if you look at querystring it should give me - 4. Junli Zhuang & Kangna Zeng

I tried using like this but it did not help -

 string uploadDirectoryStructure = HttpUtility.UrlEncode(context.Request.QueryString["fp"].ToString())

Please suggest.

2 Answers 2

2

Your input query string is incorrect. The symbol & should be URL encoded to %26. Otherwise it indicates the next pair in the query string.

Sign up to request clarification or add additional context in comments.

Comments

1

Do you have control of the application that is generating the query string? If it is generated on a web page, you can use encodeURIComponent() on it like so via javascript that will encode the & symbol.

encodeURIComponent("Junli+Zhuang+&+Kangna+Zen");

Otherwise, if it is out of your control, then you can use Request.Url.Query in your controller action, and the process the string manually to get everything after fp

 var startSegment = "&fp";
 var result = Request.Url.Query.Substring(myString.IndexOf(startSegment) + startSegment.Length);

Comments

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.