c# - How do I change a '\' to a '/' -


my web program getting error when trying access file in code behind c# program has backward slash between directory name , file name. address file comes web page query value of 'deaths\bakerd.htm'. browser, however, converts 'deaths%08akerd.htm'.

the url in webpage reads

 'http://localhost:57602/obitm.aspx?url=deaths%08akerd.htm'  

and says web page cannot found webpage obitm.aspx exist why doesn't?

if manually change value of query value in windows explorer 'deaths/bakerd.htm' doesn't conversion when coming in query value in browser , able access file in c# program.

i tried change query value in javascript using

   thisurl = url.replace("\\", "/")  

but didn't change anything.

i haven't tried conversion in c# program. how programmatically change '\' '/'? have no idea why happening , confusing. appreciated.

just converting \ / in url string won't work you, because in case "\b" being turned backspace character gets encoded %08 - hex value ascii equivalent of backspace character.

to fix 1 occurrence, convert "%08" string "/b" there lots of html codes various characters not productive or fun try.

where getting original string containing file name name from? if have control on convert "\" "/" @ point when read path / name of file , before pass in url web app.

you htmlencode path before sending string becomes

http://localhost:57602/obitm.aspx?url=deaths%92bakerd.htm'  

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -