Question

Im trying to parse a response from an authentication server that is url encoded. However when I do it I am getting \r\n characters. And I need to not have these in my text as I need to be able to run a regular expression that looks for white space but doesnt work with these escape characters.

So basically the string returned is:

ClientIP=192.168.20.31%0d%0aUrl%3d%2fflash%2f56553550_hi%3funiqueReference%3d27809666.mp4

After url decoding it it is:

192.168.20.31\r\nUrl=/flash/56553550_hi?uniqueReference=27809666.mp4

So you see I dont want it to have \r \n etc I want to have:

"192.168.20.31 Url=/flash/56553550_hi?uniqueReference=27809666.mp4"

As a verbatim string in c#.

Is this possible? Or do I have to do a string.replace on \r and replace with " "?

Was it helpful?

Solution

Either replace %0d%0a with %20 before URL decoding the string, or the \r\n with after.

Since the data exists in the original string, you can't just make it go away without replacing it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top