2007年3月小记

系统 1653 0

1、使用System.Web.Hosting.HostingEnvironment.MapPath方法也可以获取"~/path/*.*"文件的绝对路径。
2、在IIS7使用ASP.NET AJAX时,网站的应用程序池必须设置为集成模式(integrated)
3、SQL数据库远程链接。

     -- 远程链接获取信息
     EXEC  sp_addlinkedserver 
        
@server = ' ls_instance ' , -- 别名
         @provider = ' SQLOLEDB ' ,
        
@srvproduct = '' ,
        
@datasrc = 'www.cnblogs.com ' -- 远程服务器名

    
EXEC  sp_addlinkedsrvlogin 
        
@rmtsrvname = ' ls_instance ' ,
        
@useself = ' false ' ,
        
@locallogin = ' sa ' ,
        
@rmtuser = ' sa ' ,
        
@rmtpassword = ' 123456 '


    
EXEC  sp_droplinkedsrvlogin  ' ls_instance ' ' sa '
    
-- EXEC sp_linkedservers
     EXEC  sp_dropserver  ' ls_instance '

4、如何在VS2005 SP1中打开HTML编辑器中的元素的属性显示?
      工具-->选项-->文本编辑器-->HTML-->杂项-->选择“在源视图中启用属性网格”
 
5、导出某列表控件到一个Excel表格

     public   void  ToExcel(System.Web.UI.Control ctl)
    
{
        Response.Clear();
        Response.AppendHeader(
" Content-Disposition " " attachment;filename=Excel.xls " );
        Response.Charset 
=   " GB2312 " ;
        Response.ContentEncoding 
=  System.Text.Encoding.GetEncoding( " GB2312 " );
        Response.ContentType 
=   " application/ms-excel " ;
        ctl.Page.EnableViewState 
=   false ;
        System.IO.StringWriter tw 
=   new  System.IO.StringWriter();
        System.Web.UI.HtmlTextWriter hw 
=   new  System.Web.UI.HtmlTextWriter(tw);
        ctl.RenderControl(hw);
        HttpContext.Current.Response.Write(tw.ToString());
        HttpContext.Current.Response.End();
    }

6、简单判断是否为IE。 if(!document.uniqueID) window.location = window.location;

7、在ASP.NET AJAX中如何判断浏览器及计算其宽高。
             function  getClientBounds()
            
{
                
var  clientWidth;
                
var  clientHeight;
                
switch (Sys.Browser.agent)  {
                    
case  Sys.Browser.InternetExplorer:
                        clientWidth 
=  document.documentElement.clientWidth;
                        clientHeight 
=  document.documentElement.clientHeight;
                        
break ;
                    
case  Sys.Browser.Safari:
                        clientWidth 
=  window.innerWidth;
                        clientHeight 
=  window.innerHeight;
                        
break ;
                    
case  Sys.Browser.Opera:
                        clientWidth 
=  Math.min(window.innerWidth, document.body.clientWidth);
                        clientHeight 
=  Math.min(window.innerHeight, document.body.clientHeight);
                        
break ;
                    
default :   //  Sys.Browser.Firefox, etc.
                        clientWidth  =  Math.min(window.innerWidth, document.documentElement.clientWidth);
                        clientHeight 
=  Math.min(window.innerHeight, document.documentElement.clientHeight);
                        
break ;
                }


                
return   new  Sys.UI.Bounds( 0 0 , clientWidth, clientHeight);
            }

8、 Vista侧边栏安装与配置
9、Passport学习:
Passport 身份验证  
在ASP.NET应用程序中集成Passport验证

2007年3月小记


更多文章、技术交流、商务合作、联系博主

微信扫码或搜索:z360901061

微信扫一扫加我为好友

QQ号联系: 360901061

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。

【本文对您有帮助就好】

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描上面二维码支持博主2元、5元、10元、自定义金额等您想捐的金额吧,站长会非常 感谢您的哦!!!

发表我的评论
最新评论 总共0条评论