RSS 2.0 Feed
Dot NET
.NET programming, design, ...
摘要:这是我前阵子自己遇到的一个问题。当时有一个表,表大致是长这样的:GroupID SectionID CreatedTime TextValue ----------- ----------- ------------------------ ----------- 1 1 2007-07-10 00:00:00.000 1-1-07-10 1 1 2007-07-11 00:00:00.000 1-1-07/11 1 2 ......[阅读全文]

posted @ | Feedback (42) | Filed Under [ Dot NET ]

摘要:This is a bug. On Windows 2003, World Wide Web Publishing Service depends on HTTP SSL and IIS Admin Service, which is to say, if HTTP SSL is stopped, World Wide Web Publishing Service cannot be running. However, recently, for multiple times, on my test machine, after running "iisreset", I see that World Wide Web Publishing Service is "Started" while HTTP SSL is "Stopped". The event log tells us the answer: From 12:58:19AM ("The HTTP SSL service was successfully sent a stop control") to 12:58:21AM ("The HTTP SSL service entered the stopped state"), the status of HTTP SSL service is "Stopping". Windows was kind of cheated. Windows thought......[阅读全文]

posted @ | Feedback (4) | Filed Under [ Dot NET ]

摘要:Lots of people have seen the client certificate selection dialog when we use IE to browser HTTPS resources. Few people have thought about and understand why the certificate selection dialog doesn't include all certificate in personal store. The fact is: IE has received an acceptable issuer list from the web server side. IE will show nothing in the certificate selection dialog if there is no certificate which has "Client Authentication" usage and issued by any issuer (aka CA, root or intermediate CA) on that acceptable issuer list. Knowing the acceptable issuer list of a certain web server is one of the key factors to troubleshotting HTTPS connectivity issues.......[阅读全文]

posted @ | Feedback (3) | Filed Under [ Dot NET ]

摘要:1. The Google Data API document is not updated. On Google Data APIs (Beta) Developer's Guide, the feed URL is http://www.blogger.com/feeds/blogID/posts/full. But this URL doesn't work once one has upgraded his/her blogger to beta (http://beta.blogger.com). The correct feed URL for Blogger Beta is http://blogID.blogspot.com/feeds/posts/full, which can be found in another place, Blogger's known issue list. Expected: Google should've put the new feed URL into the Google Data APIs (Beta) Developer's Guide. 2. Blogger Beta's updated-min query doesn't work with earlier-than-GMT timezones Simply repro by trying these two URLs in my browsers (either Mozilla 1.5 or IE 6.0 SP2): http://zhengziying.blogspot.com/feeds/posts/full?updated-min=2006-10-09T10:57:00+08:00&max-results=70 http://zhengziying.blogspot.com/feeds/posts/full?updated-min=2006-10-09T10:57:00-08:00&max-results=70 The only difference between......[阅读全文]

posted @ | Feedback (14) | Filed Under [ Dot NET ]

摘要:昨天发现一个现象,如果: 一个cert是由Windows 2003 Certificate Service颁发的,而且Subject CN中带有下划线("_"),例如SPK_PARTNER_ADCENTER; IIS中创建了client cert mapping,rule是Subject CN = SPK_PARTNER_ADCENTER; 这种情况下,当客户端用这个cert来访问时,这条mapping rule会被跳过。 例如,我的三个cert的Subject分别是:Subject: E=nssdev@microsoft.com CN=SPKPARTNERADCENTER OU=SPG O=Microsoft L=Redmond S=WA C=US Subject: E=nssdev@microsoft.com CN=SPK_PARTNER_ADCENTER OU=SPG O=Microsoft L=Redmond S=WA C=US Subject: CN=SPK_PARTNER_CSS OU=SPG O=MS L=Redmond S=WA C=US ......[阅读全文]

posted @ | Feedback (8) | Filed Under [ Dot NET ]

摘要:有人问起怎么在.NET 1.1里面用byte[]创建X509Certificate实例,以及怎么用X509Certificate来访问需要客户端证书的Web Service。MSDN里面对.NET 1.1里面怎么用证书讲的不是很完整,虽然有例子代码,但是第一次用的人还是需要费一番精神才能搞出来。我从硬盘里找了段以前的code给了他,顺便也在这里贴一下,也好让各种搜索引擎访问到://.net 1.1 version bdk bd = new bdk(); StreamReader reader = new StreamReader(path); //path of .cer file string certbody = reader.ReadToEnd(); certbody=certbody.Replace("-----END CERTIFICATE-----",""); certbody=certbody.Replace("-----BEGIN CERTIFICATE-----",""); certbody=certbody.Replace("\r\n",""); // Get client certificate byte[] certbytes = System.Convert.FromBase64String(certbody); X509Certificate cert = new X509Certificate(certbytes); bd.ClientCertificates.Clear(); bd.ClientCertificates.Add(cert); //Then we can TestConnection //if failed , TestConnection will throw an SoapException, try to catch it string aa; bd.TestConnection("input", out aa); 这里的.cer文件是从Certificates MMC里面export出来的,或者也可以从IE的option里面导出。导出时候要选择"Not to export private key",用"Base64 Encode"格式导出。这里的"bdk"类就是一个Web Service的proxy类,TestConnection()是一个WebMethod。 在.NET 2.0里面,代码就可以简洁得多了,只需要一个调用就可以了,不需要自己手工读文件、去头去尾以及转换成byte[]了。...[阅读全文]

posted @ | Feedback (10) | Filed Under [ Dot NET ]

摘要:(摘自我所在的产品组的"Coding Guidelines for SQL code") In a lot of places, cursors are used to traverse through a recordset. However, a lot of cursors are defined like this:DECLARE @myCursor CURSOR FOR SELECT … FROM TABLE OPEN @myCursor -- do something CLOSE @myCursor DEALLOCATE @myCursor The above code has several problems: The CURSOR is defined as a GLOBAL cursor, meaning that several sessions can access the same cursor. If two sessions happen to execute the same proc at the same time, one of them will fail with 'CURSOR ALREADY EXISTS' error. If an exception is raised, the CLOSE/DEALLOCATE is never called, causing a......[阅读全文]

posted @ | Feedback (17) | Filed Under [ Dot NET ]

摘要:WiX(Windows Installer XML)是Rob Mensching(Windows组的一个SDE)写的一个用来编写MSI安装包的工具集,已经被微软内部的很多产品组采用,例如Office组,以及我所在的MSN组,等等。 下面是WiX的一个简单例子(相当于高级的Hello World!的级别),在这个例子中编写了一个SimpleCopy.msi。安装SimpleCopy.msi将能够: 创建C:\Program Files\SimpleCopy目录并拷贝一系列文件; 创建HKEY_LOCAL_MACHINE\SOFTWARE\MPG Lab注册表键,该键下的DestPath变量存储了一个文件路径,DestPath可以在msiexec命令行中用DESTPATH来指定; 创建名为SimplyCopy的Scheduled Task,该任务每小时运行一次,执行C:\Program Files\SimpleCopy\SimpleCopy.exe,将该目录下data\source.xml拷贝到DestPath中指定的目录; Uninstall时,安装时拷贝的文件、创建的注册表键和Scheduled Task都将被删除。 下面就是用WiX编写SimpleCopy.msi的步骤: 1. 从http://sourceforge.net/projects/wix下载wix的2.0.3220.0版本并解压到硬盘,将candle.exe所在的路径添加到Path环境变量中;2. 用C#编写SimpleCopy.cs并用csc.exe在同一目录下编译成SimpleCopy.exe:using System; using System.IO; using System.Reflection; using Microsoft.Win32; namespace SimpleCopy ...{ internal class Application ...{ [STAThread] private static void Main(string[] args) ...{ string sourcexml = GetExecutableLocation() + @"\data\source.xml"; if (File.Exists(sourcexml))...{ ......[阅读全文]

posted @ | Feedback (4) | Filed Under [ Dot NET ]

摘要:I just get an internal notice saying that www.microsoft.com production servers are scheduled for upgrade to ASP.NET 2.0 by September 8, 2005. Wow, I think they are crazy of moving to ASP.NET 2.0 while it's still in Beta stage, thought it must be a cool showcase of ASP.NET 2.0....[阅读全文]

posted @ | Feedback (7) | Filed Under [ Dot NET ]

摘要:I chose the Windows XP Pro x64 Edition for my new working machine, a DELL Precision 380, as long as it has an Intel EM64T processor. Having bad luck, after installing .NET 2.0 Beta 2 Redist (x64), IIS 6.0 and Visual Studio 2003 one by one, I got errors in Visual Studio 2003 when creating new ASP.NET Web Application project. It took me about two hours painful time to figure it out. In short, root causes are 1) the coexistence of .NET 1.1 & 2.0 and 2) the x64 OS. Summarize my findings as below for upcoming developers: Error 1: You may see an......[阅读全文]

posted @ | Feedback (7) | Filed Under [ Dot NET ]

Full Dot NET Archive