ASP.Net零碎笔记ing

1,DataSet判断其中数据是否为空值
     bool DataRow.IsNull(DataColumn あるいは int あるいは string)

2,   String scriptString = "<script language=JavaScript> function DoClick() {";
      scriptString += "showMessage2.innerHTML='<h4>Welcome to Microsoft .NET!</h4>'}";
      scriptString += "function Page_Load(){ showMessage1.innerHTML=";
      scriptString += "'<h4>RegisterStartupScript Example</h4>'}</script>";

    if(!this.IsStartupScriptRegistered("Startup"))
        this.RegisterStartupScript("Startup", scriptString);//声明javascript函数在紧接着<from>之后,在所有html控件之前声明事件

    if(!IsPostBack)
        this.RegisterRequiresPostBack(TextBox1);//声明javascript函数在</from>之前,以保证。所有的控件都已经声明在先


3,  Response.AddHeader "Content-Disposition","attachment; filename=fname.ext"
    文件头指明文件格式

4,    DateTime.TryParse()
       DateTime.Parse(strDate);//日期字符串转为日期类型
       DateTime.ParseExact(strDate, "yyyyMMdd", CultureInfo.CurrentCulture);
public static bool IsDate(string strDate) 
{
    DateTime dtDate;
    bool bValid = true;
    try 
    {
        dtDate = DateTime.Parse(strDate);
    }
    catch (FormatException eFormatException) 
    {
        string message = eFormatException.Message;    //eFormatExceptionが使用されないというワーニングを抑制するため。
        // the Parse method failed => the string strDate cannot be converted to a date.
        bValid = false;
    }
    return bValid;
}


















5,涉及到,系统文件读写权限的.Net配置模式
要注意以下几点的配置
*1,IIS中的站点属性设置中,配置[安全]中的匿名登陆与认证,将用户指定Administrator
好危险的样子,不过我试过用别的角色,都不行啊!!那位大哥告诉我一下,该怎么办呢)。
*2, Web.config 中
配置<configuration>
<identity impersorate=“true“/>


<authentication mode=“windows“/>

<appSettings>//顺便带上数据库设置,呵呵,必不可少阿
<add key=“strConn“ value=“server=IP;database=DBName;uid=UserID;pwd=Password;“/>
</appSettings>
</configuration>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值