2007年3月小记

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(00, clientWidth, clientHeight);
            }

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

原文地址:https://www.cnblogs.com/chenjunbiao/p/1760241.html