示例#1
0
 public string Decode(string s)
 {
     if (String.IsNullOrEmpty(s))
     {
         throw new ArgumentNullException("s");
     }
     return(_server.HtmlDecode(s));
 }
示例#2
0
 public string HtmlDecode(string s)
 {
     return(_server.HtmlDecode(s));
 }
 public override string HtmlDecode(string s)
 {
     return(_httpServerUtility.HtmlDecode(s));
 }
示例#4
0
 public static string UnescapeHtml(string escaped)
 {
     return(HttpServerUtility.HtmlDecode(escaped));
 }
        public void Methods_Deny_Unrestricted()
        {
            hsu.ClearError();

            Assert.IsNull(hsu.GetLastError(), "GetLastError");

            Assert.IsNotNull(hsu.HtmlDecode(String.Empty), "HtmlDecode(string)");
            hsu.HtmlDecode(String.Empty, sw);

            Assert.IsNotNull(hsu.HtmlEncode(String.Empty), "HtmlEncode(string)");
            hsu.HtmlEncode(String.Empty, sw);

            try
            {
                Assert.IsNull(hsu.MapPath(String.Empty), "MapPath(string)");
            }
            catch (NullReferenceException)
            {
                // ms 1.x
            }

            try
            {
                hsu.Transfer("/");
            }
            catch (NullReferenceException)
            {
                // ms
            }
            try
            {
                hsu.Transfer("/", true);
            }
            catch (NullReferenceException)
            {
                // ms
            }
            try
            {
                hsu.Transfer("/", false);
            }
            catch (NullReferenceException)
            {
                // ms
            }
#if NET_2_0
            try
            {
                hsu.Transfer((IHttpHandler)null, true);
            }
            catch (NullReferenceException)
            {
                // ms
            }
            try
            {
                hsu.Transfer((IHttpHandler)null, false);
            }
            catch (NullReferenceException)
            {
                // ms
            }
#endif
            try
            {
                Assert.IsNotNull(hsu.UrlDecode(url), "UrlDecode(string)");
            }
            catch (NullReferenceException)
            {
                // ms
            }
            try
            {
                hsu.UrlDecode("http://www.mono-project.com/", sw);
            }
            catch (NullReferenceException)
            {
                // ms
            }

            Assert.IsNotNull(hsu.UrlEncode(String.Empty), "UrlEncode(string)");
            hsu.UrlEncode(String.Empty, sw);

            Assert.IsNotNull(hsu.UrlPathEncode(String.Empty), "UrlPathEncode(string)");
        }
示例#6
0
 public static string FromXmlValue2Render(this string s, HttpServerUtility sr)
 {
     s = s.Replace("'", "'");
     // incredible but this code is ok...
     return(sr.HtmlEncode(sr.HtmlDecode(s)));
 }