G
Guadala Harry
I'd like to know the answer to the following question so I can know what to
expect with regard to other similar uses of escape characters and strings.
While everything works fine - I'd like to know specifically why:
I am building a simple HTML table in my C# code-behind by concatenating
strings that contain different parts of the table and table content...
something like this:
string myTable = "<table width=\"100%\" border=\"0\" cellspacing=\"0\"
cellpadding=\"0px\" class=\"myCSSClass\"><tr><td>";
Notice the back-slash (\) character which is there to escape each of the
double-quote (") characters.
After the table is finished being constructed, it exists in one string
variable - which I HtmlEncode prior to returning to the caller.
The calling method then HtmlDecodes that string, and for testing purposes
renders to the browser via Response.Write(). The table renders just
beautifully. While that is good news, I'm curious as to what is happening to
the \ escape characters. They are all present in the HtmlDecoded string, of
course - which is fed into Response.Write(). The value of the string that
shows up in the browser (i.e., the <table> definition) does *not* have the
escape characters (at least as the browser shows the rendered page). So,
when were they removed, and what removed them?
In trying to determine where the escape characters are being removed (client
or server side), I pasted the string value with the escape characters (the
value that is fed to Response.Write()) directly into the ASPX file - and it
failed to render correctly, as all of the escape characters were present.
So, apparently the browser is not removing them. What specifically is
removing them?
Thanks!
expect with regard to other similar uses of escape characters and strings.
While everything works fine - I'd like to know specifically why:
I am building a simple HTML table in my C# code-behind by concatenating
strings that contain different parts of the table and table content...
something like this:
string myTable = "<table width=\"100%\" border=\"0\" cellspacing=\"0\"
cellpadding=\"0px\" class=\"myCSSClass\"><tr><td>";
Notice the back-slash (\) character which is there to escape each of the
double-quote (") characters.
After the table is finished being constructed, it exists in one string
variable - which I HtmlEncode prior to returning to the caller.
The calling method then HtmlDecodes that string, and for testing purposes
renders to the browser via Response.Write(). The table renders just
beautifully. While that is good news, I'm curious as to what is happening to
the \ escape characters. They are all present in the HtmlDecoded string, of
course - which is fed into Response.Write(). The value of the string that
shows up in the browser (i.e., the <table> definition) does *not* have the
escape characters (at least as the browser shows the rendered page). So,
when were they removed, and what removed them?
In trying to determine where the escape characters are being removed (client
or server side), I pasted the string value with the escape characters (the
value that is fed to Response.Write()) directly into the ASPX file - and it
failed to render correctly, as all of the escape characters were present.
So, apparently the browser is not removing them. What specifically is
removing them?
Thanks!