写类文件时候不只是个把地方要用到某些方法,就不想引入命名空间了。哎,搞不清楚,记录下吧。用到个记录个。 

注意以下要添加项目引用 System.Web.dll 

使用using System.Configuration;这些需要using System.Configuration;命名空间 

  public void Break(string StrInfo) 
  {   
   System.Web.HttpContext.Current.Response.Write("<script>alert(\'"+ StrInfo +"\');history.back();</script>"); 
   System.Web.HttpContext.Current.Response.End(); 
  } 

userjudge2=System.Text.Encoding.Default.GetByteCount(str); 

StringBuilder sb=new StringBuilder();

sb.Append("×××)"); 


 

Response

System.Web.HttpContext.Current.Response.Write ("<script>alert(\'" + ErrInfo + "\');history.back();<" + "/script>"); 

 

Server.MapPath  

System.Web.HttpContext.Current.Server.MapPath( 
   ConfigurationSettings.AppSettings[
"AC_DbPath"]); 


Session 

System.Web.HttpContext.Current.Session["AdmCheckCode"]  

MD5 

System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str,"MD5"

ConfigurationSettings

System.Configuration.ConfigurationSettings.AppSettings["MailFrom"]; 

ServerVariables (热,找了我半天才找到。 )

System.Collections.Specialized.NameValueCollection  ServerVariables = System.Web.HttpContext.Current.Request.ServerVariables; 
   Response.Write(ServerVariables[
"HTTP_REFERER"]); 

HtmlEncode

System.Web.HttpUtility.HtmlEncode(msg)

 PagedDataSource

private System.Web.UI.WebControls.PagedDataSource _objpds;

 Regex正则表达式

System.Text.RegularExpressions Regex

 

 

Request.CurrentExecutionFilePath 获取当前请求的虚拟路径
StreamReader sr = File.OpenText(
    System.Web.HttpContext.Current.Server.MapPath("Resource/Templet"));

posted on 2008-09-12 14:54  晃晃悠悠  阅读(371)  评论(0)    收藏  举报