Asp.net 随记 Part4 (71-90 )
89.无法启动MSMQ服务
http://blog.csdn.net/coofucoo/archive/2009/08/27/4489598.aspx
运行下输cmd,然后再输
net stop msdtc
msdtc -uninstall
msdtc -install
net start msdtc
就可以解决了。
88.基于声明身份验证机制
http://www.infoq.com/cn/news/2009/10/Guide-Claim-Based-Identity
87.XmlHttp 跨域的解决方案
http://www.javaeye.com/topic/15641
86.应对IE8,你的网站添加X-UA-Compatible meta标签了吗?
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />标签!
85.负载均衡
群集服务器之WINDOWS 2003网络负载均衡配置
Windows 2003实现多台服务器网络负载均衡
WEB服务器负载均衡问题的解决
84.JavaScript TimeLine
http://blog.joycode.com/kaneboy/archive/2009/09/24/115713.joy
83.对于一个不断增加值(如:文本值)的数据字段来说,这个字段的DataType最好是什么(nvarchar,还是text)
82.JS获取MAC地址
http://zhupan.javaeye.com/blog/26440
http://www.javaeye.com/wiki/topic/382042
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<SCRIPT language=JScript event="OnCompleted(hResult,pErrorObject, pAsyncContext)" for=foo>
document.forms[0].txtMACAddr.value=unescape(MACAddr);
document.forms[0].txtIPAddr.value=unescape(IPAddr);
document.forms[0].txtDNSName.value=unescape(sDNSName);
//document.formbar.submit();
</SCRIPT>
<SCRIPT language=JScript event=OnObjectReady(objObject,objAsyncContext) for=foo>
if(objObject.IPEnabled != null && objObject.IPEnabled != "undefined" && objObject.IPEnabled == true)
{
if(objObject.MACAddress != null && objObject.MACAddress != "undefined")
MACAddr = objObject.MACAddress;
if(objObject.IPEnabled && objObject.IPAddress(0) != null && objObject.IPAddress(0) != "undefined")
IPAddr = objObject.IPAddress(0);
if(objObject.DNSHostName != null && objObject.DNSHostName != "undefined")
sDNSName = objObject.DNSHostName;
}
</SCRIPT>
<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY>
<OBJECT id=locator classid=CLSID:76A64158-CB41-11D1-8B02-00600806D9B6 VIEWASTEXT></OBJECT>
<OBJECT id=foo classid=CLSID:75718C9A-F029-11d1-A1AC-00C04FB6C223></OBJECT>
<SCRIPT language=JScript>
var service = locator.ConnectServer();
var MACAddr ;
var IPAddr ;
var DomainAddr;
var sDNSName;
service.Security_.ImpersonationLevel=3;
service.InstancesOfAsync(foo, 'Win32_NetworkAdapterConfiguration');
</SCRIPT>
<FORM id="formfoo" name="formbar" action="index.do" method="post"><INPUT value="00-11-11-B4-52-EF" name="txtMACAddr"> <INPUT value="210.42.38.50" name="txtIPAddr"> <INPUT value="zhupan" name="txtDNSName"> </FORM></BODY></HTML>
81.WebService IList
http://blog.csdn.net/kbynii/archive/2007/01/31/1498938.aspx
80.有关于设置CodePage,在后台取TextBox值中的乱码的解决方案
aspx 设置 CodePage=936
必须相应在设置 requestEncoding,responseEncoding的编码。不然会出现乱码的情况
如:<globalization requestEncoding="gb2312" responseEncoding="gb2312"/>
79.有关于统计的SQL
ID CID DType uType
1 100003 1 2
2 100003 2 3
3 100004 1 2
4 100004 2 1
5 100005 1 2
6 100005 2 2
我想统计一下,按Dtype为类型统计
uType 1:需要2偶尔需求3不需要
输出结果:
DType 需要偶尔需求不需要
1 3票
2 1票1票1票
CREATE TABLE Skipper
(
ID INT PRIMARY KEY,
CID INT,
DType INT,
UType INT
)
INSERT INTO Skipper VALUES(1,100003,1,2)
INSERT INTO Skipper VALUES(2,100003,2,3)
INSERT INTO Skipper VALUES(3,100004,1,2)
INSERT INTO Skipper VALUES(4,100004,2,1)
INSERT INTO Skipper VALUES(5,100005,1,2)
INSERT INTO Skipper VALUES(6,100005,2,2)
--传统方法:
SELECT DType,
SUM(CASE WHEN UType=1 THEN 1 ELSE 0 END) AS [需要],
SUM(CASE WHEN UType=2 THEN 1 ELSE 0 END) AS [偶尔需要],
SUM(CASE WHEN UType=3 THEN 1 ELSE 0 END) AS [不需要]
FROM Skipper WITH(NOLOCK)
GROUP BY DType
ORDER BY DType
--SQL Server 2005方法:
SELECT DType,[1] AS [需要],[2] AS [偶尔需要],[3] AS [不需要]
FROM (
SELECT ID,DType,UType
FROM Skipper WITH(NOLOCK)
) AS T
PIVOT (
COUNT(ID)
FOR UType IN ([1],[2],[3])
) AS PVT
ORDER BY DType
78.Html To PDF(http://www.websupergoo.com/abcpdf-9.htm)
介绍:WebSupergoo ABCpdf DotNET 用ABCpdf控件可以非常容易地动态生成Adobe PDF文档。你将不会相信它是多么的简单,功能又是如此之强大
序列号:341-639-358 for a Standard License or
719-253-057 for a Professional License
例子:(http://www.websupergoo.com/abcpdf-9.htm)
77.IIS7.0 检测到在集成的托管管道模式下不适用的ASP.NET设置 的解决方法
解决方案:在应用程序池的高级设置里有个托管管道模式,默认值为Integrated,我们将其修改为Classic,就可以很好的解决问题了。
76.用户控件(.ascx)与网页间(.aspx)如何传值的几种方法
1.aspx文件:
public void SetLabel(string str)
{
this.Label1.Text = str; ;
}
ascx文件;
protected void Button1_Click(object sender, EventArgs e)
{
System.Web.UI.Page p = this.Page;
Type pageType = p.GetType();
MethodInfo mi = pageType.GetMethod("SetLabel");
mi.Invoke(p, new object[] { "你这个大猪猪!" });
}
2. 在自定义控件中定义这个控件的属性
public Control LabelText
{
get{return this.Label1.Text;}
}
3用FindControl方法寻找
Label lbl = (Label)WebUserControl1.FindControl("Label1");
75.网页切换效果(Fade)
このページの構文
<meta http-equiv="page-enter" content="progid:DXImageTransform.Microsoft.Fade(Duration=3)">
5.5~
ページ移動に指定するには、<head>から</head>までの間に下記のように記述します。 http-equiv=は切り替え区分で、下記の範囲からイベントを指定します。 Duration=は効果の時間で、下記のように秒数を指定します。 Overlap=は効果の度合で、下記のいずれかを指定します。 Enabled=は効果の有無で、下記のいずれかを指定します。 |
74.一个利用扩展方法的实例:AttachDataExtensions
http://www.cnblogs.com/JeffreyZhao/archive/2009/01/07/AttachDataExtensions.html
73.http://www.codeproject.com/KB/miscctrl/DropDownWithAutoComplete.aspx
72. MultiSelect Dropdown Controlhttp://www.codeproject.com/KB/user-controls/Multiselect-Dropdown.aspx
71.javascript终极屏蔽右键/禁止复制/禁止另存/禁止右键/禁止选取/禁止粘贴的方法禁止另存代码:
<iframe src="/*>";</iframe>
</noscript>
禁止复制代码:
oncontextmenu='return false'
ondragstart='return false'
onselectstart ='return false'
onselect='document.selection.empty()'
oncopy='document.selection.empty()'
onbeforecopy='return false'
onmouseup='document.selection.empty()'>
禁止右键:
禁止选取:
禁止粘贴:
Asp.Net 经验系列