I recently installed Visual-Web-Developer 10 and open my old asp.net 3.5 solution in it
and converted it to asp.net 4 solution.
every thing is working fine exept one strange problem:
suddenly all chars like: ' or " in header script code become: ' or "
and this making all my javascript do not work and give error in all my solutuin pages.
i tryed to save the page in different encoding but it did not help: here is example of what happening: in server side code:
HtmlGenericControl Include = new HtmlGenericControl("script");
Include.Attributes.Add("type", "text/JavaScript");
Include.InnerText = "browser = \"ie\"; browserVer = '8'; bodyDir = 'rtl'; adverID = '123'; webKind = 'adver';";
Page.Header.Controls.Add(Include);
Include.Dispose();
on user side i get:
<script type="text/JavaScript">browser = "ie"; browserVer = '8'; bodyDir = 'rtl'; adverID = '123'; webKind = 'adver';</script>
big thanks for any halp chainan
Use the InnerHtml
property instead, to add the contents of the script. The InnerText
gets converted..
Quote from InnerText
Unlike the
InnerHtml
property, theInnerText
property automatically encodes special characters to and from HTML entities. ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With