常用命名空间位置

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

注意以下要添加项目引用 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 @ 2005-12-07 21:49 堕落的卖猪贩 阅读(543) 评论(1)  编辑 收藏 所属分类: DotNet总结

  回复  引用    
#1楼 2006-11-03 13:43 | 第三 [未注册用户]
谢谢搂住,我也正找此文呢

标题  
姓名  
主页
Email (博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  博客园首页

  新闻频道

  社区

  小组

  博问

  网摘

  闪存

  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
该文被作者在 2006-03-25 22:45 编辑过
成果网帮您增加网站收入


相关链接: