<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type='text/xsl' href='http://aspnet.spaces.live.com/mmm2008-07-24_12.50/rsspretty.aspx?rssquery=en-US;http%3a%2f%2faspnet.spaces.live.com%2fcategory%2f%e8%ae%a1%e7%ae%97%e6%9c%ba%e4%b8%8e%2bInternet%2ffeed.rss' version='1.0'?><rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:msn="http://schemas.microsoft.com/msn/spaces/2005/rss" xmlns:live="http://schemas.microsoft.com/live/spaces/2006/rss" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:cf="http://www.microsoft.com/schemas/rss/core/2005" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Microsoft.NET BLOG(YunYang): 计算机与 Internet</title><description /><link>http://aspnet.spaces.live.com/?_c11_BlogPart_BlogPart=blogview&amp;_c=BlogPart&amp;partqs=cat%25E8%25AE%25A1%25E7%25AE%2597%25E6%259C%25BA%25E4%25B8%258E%2bInternet</link><language>en-US</language><pubDate>Thu, 04 Sep 2008 09:37:07 GMT</pubDate><lastBuildDate>Thu, 04 Sep 2008 09:37:07 GMT</lastBuildDate><generator>Microsoft Spaces v1.1</generator><docs>http://www.rssboard.org/rss-specification</docs><ttl>60</ttl><cf:parentRSS>http://aspnet.spaces.live.com/blog/feed.rss</cf:parentRSS><live:type>blogcategory</live:type><live:identity><live:id>-5487770763778616419</live:id><live:alias>aspnet</live:alias></live:identity><cf:listinfo><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="typelabel" label="Type" /><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="tag" label="Tag" /><cf:group element="category" label="Category" /><cf:sort element="pubDate" label="Date" data-type="date" default="true" /><cf:sort element="title" label="Title" data-type="string" /><cf:sort ns="http://purl.org/rss/1.0/modules/slash/" element="comments" label="Comments" data-type="number" /></cf:listinfo><item><title>security 4 ASP.NET -编写安全的ASP.NET应用</title><link>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!584.entry</link><description>&lt;div&gt;&lt;strong&gt;&lt;font color="#ff0000" size=4&gt;Hi,everybody:&lt;/font&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;font color="#ff0000" size=4&gt;I hav't written article for a long period until busy working.As my msn said:&amp;quot;My head grew heavy and my sight grew dim&amp;quot;.&lt;/font&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;font color="#ff0000" size=4&gt;so I bring a new session about &amp;quot;security 4 ASP.NET&amp;quot;,it will be a series subjects.&lt;/font&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;font color="#ff0000" size=4&gt;Today let me post the vol.1.&lt;/font&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;Event Log&lt;br&gt;The Windows event log is probably the most widely known logging facility, and its API is nicely&lt;br&gt;wrapped in the Microsoft .NET Framework. You simply call EventLog.WriteEntry and pass in the&lt;br&gt;event source (that is, the name of your application), a message, and an event type (warning, error,&lt;br&gt;or critical). This will write the event to the application log.&lt;br&gt;public static void LogToEventLog(string message,&lt;br&gt;EventLogEntryType type, int id)&lt;br&gt;{&lt;br&gt;EventLog.WriteEntry(&amp;quot;Accounting Application&amp;quot;,message, type, id);&lt;br&gt;}&lt;br&gt;An event source must be registered before it can be used. Only an administrator can create new&lt;br&gt;event sources; the ASP.NET worker process does not have the required privileges to do so. The&lt;br&gt;easiest solution is to write a simple console application that pre.creates the event source at&lt;br&gt;application installation time. Afterward, your least privilege daemon account can write to the event&lt;br&gt;log.&lt;br&gt;Creating an Event Source&lt;br&gt;static void Main(string[] args)&lt;br&gt;{&lt;br&gt;EventLog.CreateEventSource(args[0], &amp;quot;Application&amp;quot;);&lt;br&gt;}&lt;br&gt;If you need more control, you can also create your own event log. Name the log after the&lt;br&gt;application, for example, Accounting Application, and register event sources such as Front End and&lt;br&gt;Data Access Component.&lt;br&gt;Creating a Custom Event Log&lt;br&gt;static void Main(string[] args)&lt;br&gt;{&lt;br&gt;string logName = &amp;quot;Accounting Application&amp;quot;;&lt;br&gt;if (!EventLog.Exists(logName))&lt;br&gt;{&lt;br&gt;EventLog.CreateEventSource(&amp;quot;Front End&amp;quot;, logName);&lt;br&gt;EventLog.CreateEventSource(&amp;quot;Data Access Component&amp;quot;, logName);&lt;br&gt;EventLog.CreateEventSource(&amp;quot;Financial Component&amp;quot;, logName);&lt;br&gt;}&lt;br&gt;}&lt;br&gt;The code for writing to a custom event log changes only slightly.&lt;br&gt;Writing to a Custom Event Log&lt;br&gt;public static void LogToEventLog(string message,&lt;br&gt;EventLogEntryType type, int id)&lt;br&gt;{&lt;br&gt;EventLog evt =&lt;br&gt;new EventLog(&amp;quot;Accounting Application&amp;quot;, &amp;quot;.&amp;quot;, &amp;quot;Front End&amp;quot;);&lt;br&gt;evt.WriteEntry(message, type, id);&lt;br&gt;}&lt;/div&gt;
&lt;div&gt;no end ,just waitting more!&lt;/div&gt;
&lt;div&gt;&lt;img src="http://img4.pcpop.com/PicImages/480x480/0/70/000070179.jpg"&gt;&lt;/div&gt;
&lt;div&gt;&lt;font color="#548dd4" size=4&gt;&lt;strong&gt;This photo make me remember a lovely girl who give me reailty love,but I hurted her.Sorry!&lt;/strong&gt;&lt;/font&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-5487770763778616419&amp;page=RSS%3a+security+4+ASP.NET+-%e7%bc%96%e5%86%99%e5%ae%89%e5%85%a8%e7%9a%84ASP.NET%e5%ba%94%e7%94%a8&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=aspnet.spaces.live.com&amp;amp;GT1=aspnet"&gt;</description><comments>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!584.entry#comment</comments><guid isPermaLink="true">http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!584.entry</guid><pubDate>Thu, 04 Sep 2008 09:14:18 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://aspnet.spaces.live.com/blog/cns!B3D78590D833939D!584/comments/feed.rss</wfw:commentRss><wfw:comment>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!584.entry#comment</wfw:comment><dcterms:modified>2008-09-04T09:37:07Z</dcterms:modified></item><item><title>IIS7管理工具包新特性</title><link>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!551.entry</link><description>&lt;div&gt;IIS要发布最新的管理包了。功能还算不错，添加了网管非常期待的站点初步流量统计功能，具体还是看Soctt的表达吧：&lt;/div&gt;
&lt;div&gt;
&lt;h3&gt;&lt;u&gt;IIS 7 Admin Pack Preview 1 Released&lt;/u&gt;&lt;/h3&gt;
&lt;p&gt;Last week the IIS team shipped the &lt;a href="http://blogs.msdn.com/carlosag/archive/2008/03/21/IISAdminPackTP1Released.aspx" target="_blank"&gt;&lt;u&gt;&lt;font color="#0066cc"&gt;first technical preview&lt;/font&gt;&lt;/u&gt;&lt;/a&gt; of some really cool administration modules that I think web developers will find super useful.  This preview adds several new features to the IIS7 Admin Tool:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Database Manager&lt;/strong&gt;: Built-in SQL Server database management, including the ability to create, delete, and edit tables and indexes, create/edit SPROCs and execute custom queries.  Because it is integrated in the IIS administration tool it all works over HTTP/SSL - which means you can use the module to remotely manage your hosted applications (even with low-cost shared hosting accounts), without having to expose your database directly on the Internet.&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Log Reports&lt;/strong&gt;: Built-in report visualization with charting support for log files data.  Full range selection and custom chart creation is supported, as well as the ability to print or save reports.  Like the database manager you can use this module remotely over HTTP/SSL - which means it works in remote shared hosting scenarios.&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Configuration Editor:&lt;/strong&gt; This is a power module that provides complete control over editing all web.config settings within the admin tool.  You can configure it to track the changes you make using the UI and have it auto-generate configuration change scripts that you can then save and tweak to re-run later in an automated way.&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Request Filtering UI:&lt;/strong&gt; This admin module provides more control over the new request filtering feature in IIS7.  Check out Carlos' blog post &lt;a href="http://blogs.msdn.com/carlosag/archive/2008/03/24/IISAdminPackRequestFiltering.aspx" target="_blank"&gt;&lt;u&gt;&lt;font color="#0066cc"&gt;here&lt;/font&gt;&lt;/u&gt;&lt;/a&gt; for details on how to use it.&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;.NET Authorization:&lt;/strong&gt; This admin module provides a custom authorization rules editor which allows you to more easily manage the ASP.NET &amp;lt;authorization&amp;gt; configuration section.&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;FastCGI UI:&lt;/strong&gt; This admin module provides more support for editing all the new &amp;lt;fastCGI&amp;gt; settings (for when you use FastCGI modules with IIS7 like PHP).&lt;/ul&gt;
&lt;p&gt;Below are some screen-shots and simple walkthroughs of the Log Reporting and Database Manager administration UI modules:
&lt;h3&gt;&lt;u&gt;Log Reporting Admin Module&lt;/u&gt;&lt;/h3&gt;
&lt;p&gt;Have you ever deployed a web application onto a server and wondered how much load it is getting?, what the average response time from the server is?, or whether many server errors are occurring (and if so on what URLs)?  All of these settings are carefully logged by IIS in a text based log file.  Today most people use command-line tools like the &lt;a href="http://www.iis.net/downloads/default.aspx?tabid=34&amp;amp;g=6&amp;amp;i=1287" target="_blank"&gt;&lt;u&gt;&lt;font color="#0066cc"&gt;IIS Log Parser&lt;/font&gt;&lt;/u&gt;&lt;/a&gt; utility to query and analyze these files.
&lt;p&gt;The IIS 7 Admin Pack and the new &amp;quot;IIS Reports&amp;quot; admin module now enable you to also query and chart your reports graphically within the IIS admin tool:
&lt;p&gt;&lt;img src="http://www.scottgu.com/blogposts/adminpack/step4.png"&gt; 
&lt;p&gt;Out of the box the &amp;quot;IIS Reports&amp;quot; admin module comes with a bunch of pre-built logparser-based reports that you can easily run on your sites and applications:
&lt;p&gt;&lt;img src="http://www.scottgu.com/blogposts/adminpack/step6.png"&gt; 
&lt;p&gt;Below is a simple graphical report we could pull up that looks at the HTTP status codes being returned by my &amp;quot;TestSite&amp;quot; application (note how we are using the &amp;quot;bar graph&amp;quot; visualization option):
&lt;p&gt;&lt;img src="http://www.scottgu.com/blogposts/adminpack/step10.png"&gt; 
&lt;p&gt;Reports can optionally be filtered using a date range.  You can also push the print or save buttons within the report page to generate a printer or a local saved version of the report.
&lt;p&gt;&lt;img src="http://www.scottgu.com/blogposts/adminpack/step7.png"&gt; 
&lt;p&gt;The IIS7 Admin Tool is a rich client application (built using WinForms) - but it does all of its remote access and work using HTTP based web-services that connect to the remote web-server.  This means it will work through firewalls, and a hoster does not need to open up ports in their network in order to enable it.  
&lt;p&gt;Once a hoster installs the IIS 7 Admin Pack on their web-servers, remote customers managing their hosted sites using the IIS admin tool (which is built-into Vista and available as a download for Windows XP clients) will automatically be prompted to enable the IIS Reports admin module (the install of the client-side module is seamless).  They'll then be able to use the reports module inside their admin tool to pull up reports for their remote hosted sites.
&lt;p&gt;&lt;em&gt;Note: hosters can optionally disable this feature if they want, or choose to restrict or customize the list of reports provided.  Hopefully most hosters will chose to just make this a standard feature of all IIS and ASP.NET plans they offer.&lt;/em&gt;
&lt;h3&gt;&lt;u&gt;Database Manager Module&lt;/u&gt;&lt;/h3&gt;
&lt;p&gt;Have you ever deployed your application and database to a remote hosting provider and wanted to make a quick change to the database (but your hosting provider didn't support accessing it using the SQL admin tool)?  Using the new &amp;quot;database manager&amp;quot; module within the IIS admin tool you can now remotely access your database and make changes to it using HTTP/SSL through the web-server.  
&lt;p&gt;Just connect your IIS administration tool to your remote site and click the new &amp;quot;Database Manager&amp;quot; icon:
&lt;p&gt;&lt;img src="http://www.scottgu.com/blogposts/adminpack/step1.png"&gt; 
&lt;p&gt;By default the Database Manager module will look at the &amp;lt;connectionStrings&amp;gt; section of your web application's web.config file, and allow you to easily access any of the databases your hosted application is using.  
&lt;p&gt;For example, below my TestSite application has a &amp;quot;NorthwindConnectionString&amp;quot; setting in the &amp;lt;connectionStrings&amp;gt; section of my web.config (which is why it shows up in my list of connection nodes).  When I click it I can view and edit my SPROCs and Table Schema (including indexes): 
&lt;p&gt;&lt;img src="http://www.scottgu.com/blogposts/adminpack/step2.png"&gt; 
&lt;p&gt;We could right-click on any table to edit the row data within it, or alternatively perform a custom SQL query to retrieve a custom set of data:
&lt;p&gt;&lt;img src="http://www.scottgu.com/blogposts/adminpack/step3.png"&gt; 
&lt;p&gt;What is nice is that a hoster can easily enable all of the above database admin features for both dedicated and shared hosting plans (even when there are hundreds or thousands of customers on a single server).  Like all other modules in the admin tool, all communication between the rich client front-end and the backend at the hoster is done over HTTP/SSL based web-services (meaning it goes through firewalls and doesn't require the hoster to open any new ports - nor expose the SQL server directly on the Internet).  
&lt;p&gt;Hopefully this database administration module will just be a standard feature that all IIS hosters enable - which will make remote hosted data management much easier going forward.
&lt;h3&gt;&lt;u&gt;Summary&lt;/u&gt;&lt;/h3&gt;
&lt;p&gt;Over time you'll see even more admin UI modules be shipped in the IIS 7 Admin Pack and many more features enabled (Carlos, who runs the dev team building the admin tool, is actively asking for suggestions on what you'd like to see via &lt;a href="http://blogs.msdn.com/carlosag/archive/2008/03/21/IISAdminPackTP1Released.aspx" target="_blank"&gt;&lt;u&gt;&lt;font color="#0066cc"&gt;his blog&lt;/font&gt;&lt;/u&gt;&lt;/a&gt; - so drop him a comment if you have a suggestion or want to provide some encouragement).
&lt;p&gt;You can download the first technical preview of IIS 7 Admin Pack release &lt;a href="http://blogs.msdn.com/carlosag/archive/2008/03/21/IISAdminPackTP1Released.aspx" target="_blank"&gt;&lt;u&gt;&lt;font color="#0066cc"&gt;here&lt;/font&gt;&lt;/u&gt;&lt;/a&gt; as well as learn more about it via the &lt;a href="http://learn.iis.net/page.aspx/401/using-the-administration-pack/" target="_blank"&gt;&lt;u&gt;&lt;font color="#0066cc"&gt;online documentation here&lt;/font&gt;&lt;/u&gt;&lt;/a&gt;.  The above modules work with both the IIS7 release in Vista SP1 as well as Windows Server 2008.&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-5487770763778616419&amp;page=RSS%3a+IIS7%e7%ae%a1%e7%90%86%e5%b7%a5%e5%85%b7%e5%8c%85%e6%96%b0%e7%89%b9%e6%80%a7&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=aspnet.spaces.live.com&amp;amp;GT1=aspnet"&gt;</description><comments>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!551.entry#comment</comments><guid isPermaLink="true">http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!551.entry</guid><pubDate>Wed, 26 Mar 2008 09:59:35 GMT</pubDate><slash:comments>1</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://aspnet.spaces.live.com/blog/cns!B3D78590D833939D!551/comments/feed.rss</wfw:commentRss><wfw:comment>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!551.entry#comment</wfw:comment><dcterms:modified>2008-03-26T09:59:35Z</dcterms:modified></item><item><title>正式发布基于VS2008的AJAX模板包</title><link>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!528.entry</link><description>&lt;div&gt;
&lt;h1&gt;Using VS2008 to Target .NET Framework 2.0 with ASP.NET AJAX&lt;/h1&gt;
&lt;p&gt;As I &lt;a href="http://blogs.msdn.com/brada/archive/2007/11/19/vs-2008-and-net-framework-3-5-rtm.aspx"&gt;&lt;u&gt;&lt;font color="#0066cc"&gt;mentioned last month&lt;/font&gt;&lt;/u&gt;&lt;/a&gt;, &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/06/20/vs-2008-multi-targeting-support.aspx"&gt;&lt;u&gt;&lt;font color="#0066cc"&gt;VS 2008 fully supports&lt;/font&gt;&lt;/u&gt;&lt;/a&gt; building applications for .NET Framework 2.0...   This is very important as it will take time for some hosters and IT organizations to fully deploy .NET Framework 3.5, but you don't want that to block you from taking full &lt;a href="http://blogs.msdn.com/brada/archive/2007/11/19/vs-2008-and-net-framework-3-5-rtm.aspx"&gt;&lt;u&gt;&lt;font color="#0066cc"&gt;advantage of the cool features in VS 2008&lt;/font&gt;&lt;/u&gt;&lt;/a&gt;.  
&lt;p&gt;Today we &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=5c7df430-1c34-40d2-b6ec-81353b5fcf2e&amp;amp;displaylang=en"&gt;&lt;u&gt;&lt;font color="#0066cc"&gt;released ASP.NET 2.0 AJAX Templates for VS2008&lt;/font&gt;&lt;/u&gt;&lt;/a&gt;.  This release contains project templates for using &lt;a href="http://msdn2.microsoft.com/en-us/vstudio/products/bb931331.aspx"&gt;&lt;u&gt;&lt;font color="#0066cc"&gt;Visual Studio 2008&lt;/font&gt;&lt;/u&gt;&lt;/a&gt; or &lt;a href="http://www.microsoft.com/express/"&gt;&lt;u&gt;&lt;font color="#0066cc"&gt;Visual Web Developer 2008&lt;/font&gt;&lt;/u&gt;&lt;/a&gt; to create new web sites and web applications with &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ca9d90fa-e8c9-42e3-aa19-08e2c027f5d6&amp;amp;displaylang=en"&gt;&lt;u&gt;&lt;font color="#0066cc"&gt;ASP.NET AJAX Extensions &lt;/font&gt;&lt;/u&gt;&lt;/a&gt;features. The project templates contain specific references to assemblies in .NET Framework 2.0 and ASP.NET 2.0 AJAX Extensions 1.0.
&lt;blockquote&gt;
&lt;p&gt;Download the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=5c7df430-1c34-40d2-b6ec-81353b5fcf2e&amp;amp;displaylang=en"&gt;&lt;u&gt;&lt;font color="#0066cc"&gt;ASP.NET 2.0 AJAX Templates for VS2008&lt;/font&gt;&lt;/u&gt;&lt;/a&gt;!&lt;/blockquote&gt;
&lt;p&gt;To try these out, make sure you have &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ca9d90fa-e8c9-42e3-aa19-08e2c027f5d6&amp;amp;displaylang=en"&gt;&lt;u&gt;&lt;font color="#0066cc"&gt;ASP.NET AJAX Extensions &lt;/font&gt;&lt;/u&gt;&lt;/a&gt;installed, then install the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=5c7df430-1c34-40d2-b6ec-81353b5fcf2e&amp;amp;displaylang=en"&gt;&lt;u&gt;&lt;font color="#0066cc"&gt;ASP.NET AJAX Templates for Visual Studio 2008&lt;/font&gt;&lt;/u&gt;&lt;/a&gt;.   
&lt;p&gt;Then, go to File-&amp;gt;New Project and select .NET Framework 2.0 as the target runtime.  That will filter down the options and you should see &amp;quot;AJAX 1.0-Enabled ASP.NET 2.0 Web Application&amp;quot;.  Select it.
&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/brada/WindowsLiveWriter/UsingVS2008toTarget.NETFramework.NETAJAX_10C29/image_2.png"&gt;&lt;img style="border-top-width:0px;border-left-width:0px;border-bottom-width:0px;border-right-width:0px" height=230 alt=image src="http://blogs.msdn.com/blogfiles/brada/WindowsLiveWriter/UsingVS2008toTarget.NETFramework.NETAJAX_10C29/image_thumb.png" width=341 border=0&gt;&lt;/a&gt; 
&lt;p&gt;Notice the assembly reference in web.config is fixed up to be the 1.0 version number...&lt;pre&gt; &lt;span style="color:blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;system.web&lt;/span&gt;&lt;span style="color:blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;pages&lt;/span&gt;&lt;span style="color:blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;controls&lt;/span&gt;&lt;span style="color:blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;add &lt;/span&gt;&lt;span style="color:red"&gt;tagPrefix&lt;/span&gt;&lt;span style="color:blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue"&gt;asp&lt;/span&gt;&amp;quot; &lt;span style="color:red"&gt;namespace&lt;/span&gt;&lt;span style="color:blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue"&gt;System.Web.UI&lt;/span&gt;&amp;quot; 
             &lt;span style="color:red"&gt;assembly&lt;/span&gt;&lt;span style="color:blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue"&gt;System.Web.Extensions, Version=1.0.61025.0, ...&lt;br&gt;&lt;/span&gt;&lt;span style="color:blue"&gt;      &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;controls&lt;/span&gt;&lt;span style="color:blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;pages&lt;/span&gt;&lt;span style="color:blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Now you are all set up to get the power of developing with VS 2008, but target .NET Framework 2.0.&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-5487770763778616419&amp;page=RSS%3a+%e6%ad%a3%e5%bc%8f%e5%8f%91%e5%b8%83%e5%9f%ba%e4%ba%8eVS2008%e7%9a%84AJAX%e6%a8%a1%e6%9d%bf%e5%8c%85&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=aspnet.spaces.live.com&amp;amp;GT1=aspnet"&gt;</description><comments>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!528.entry#comment</comments><guid isPermaLink="true">http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!528.entry</guid><pubDate>Fri, 21 Dec 2007 02:20:38 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://aspnet.spaces.live.com/blog/cns!B3D78590D833939D!528/comments/feed.rss</wfw:commentRss><wfw:comment>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!528.entry#comment</wfw:comment><dcterms:modified>2007-12-21T02:20:38Z</dcterms:modified></item><item><title>关于动态数据的新功能-ASP.NET3.5</title><link>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!522.entry</link><description>&lt;div&gt;最近没时间自己写BLOG,特地转一篇来自ASP.NET之父SCOTT大帅哥的新文章：&lt;/div&gt;
&lt;div&gt;
&lt;h2&gt;New ASP.NET Dynamic Data Support &lt;/h2&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;font face=arial size=2&gt;
&lt;p&gt;The ASP.NET 3.5 Extensions CTP &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/12/09/asp-net-3-5-extensions-ctp-preview-released.aspx" target="_blank"&gt;&lt;u&gt;&lt;font color="#0066cc"&gt;we shipped this past weekend&lt;/font&gt;&lt;/u&gt;&lt;/a&gt; contains a bunch of great new features.
&lt;p&gt;One of the cool new features is something we call &amp;quot;ASP.NET Dynamic Data Support&amp;quot;.  In a nutshell this enables you to really quickly build data driven web-sites that work against a LINQ to SQL (and in the future LINQ to Entities) object model - and optionally allows you to-do this without having to build any pages manually.
&lt;p&gt;The best way to see this in action is to watch David Ebbo's awesome &lt;a href="http://blogs.msdn.com/davidebb/archive/2007/12/12/dynamic-data-screencast-is-now-available.aspx" target="_blank"&gt;&lt;u&gt;&lt;font color="#0066cc"&gt;17 minute screen-cast&lt;/font&gt;&lt;/u&gt;&lt;/a&gt;:
&lt;p&gt;&lt;a href="http://blogs.msdn.com/davidebb/archive/2007/12/12/dynamic-data-screencast-is-now-available.aspx" target="_blank"&gt;&lt;img src="http://www.scottgu.com/blogposts/dynamicdata/step0.png"&gt;&lt;/a&gt; 
&lt;p&gt;You can also follow the steps below to easily get started and use the dynamic data support:
&lt;h4&gt;&lt;u&gt;Step 1: Create a ASP.NET Dynamic Data Site:&lt;/u&gt;&lt;/h4&gt;
&lt;p&gt;Once you have the ASP.NET 3.5 Extensions CTP release installed, you can use VS 2008 or the free Visual Web Developer 2008 Express to create a new Web Site or Web Application Project that has the ASP.NET dynamic data support enabled:
&lt;p&gt;&lt;img src="http://www.scottgu.com/blogposts/dynamicdata/step1.png"&gt; 
&lt;p&gt;This will create a new web-site you can use that has some default template files in them, along with CSS style-sheets you can use to customize the look and feel of them:
&lt;p&gt;&lt;img src="http://www.scottgu.com/blogposts/dynamicdata/step8.png"&gt; 
&lt;h4&gt;&lt;u&gt;Step 2: Add a LINQ to SQL Data Model to Your Site&lt;/u&gt;&lt;/h4&gt;
&lt;p&gt;LINQ to SQL is an &lt;a href="http://en.wikipedia.org/wiki/Object-relational_mapping" target="_blank"&gt;&lt;u&gt;&lt;font color="#0066cc"&gt;O/RM&lt;/font&gt;&lt;/u&gt;&lt;/a&gt; (object relational mapper) that ships in .NET 3.5, and which allows you to model a relational database using .NET classes.  You can then query the database using LINQ, as well as update/insert/delete data from it.  LINQ to SQL fully supports transactions, views, and stored procedures.  It also provides an easy way to integrate data validation and business logic rules into your data model.
&lt;p&gt;The easiest way to get started with an ASP.NET Dynamic Data site is to add a new LINQ to SQL data model to your project (right-click-&amp;gt;add new item-&amp;gt;LINQ to SQL Classes item).  This will bring up the LINQ to SQL class designer.  Drag database tables from your server explorer to define a set of classes (with relationships) for your database schema:
&lt;p&gt;&lt;img src="http://www.scottgu.com/blogposts/dynamicdata/step9.png"&gt; 
&lt;h4&gt;&lt;u&gt;Step 3: Enable Dynamic Templates in Your Project:&lt;/u&gt;&lt;/h4&gt;
&lt;p&gt;By default ASP.NET Dynamic Data projects provide built-in support for creating automatic &amp;quot;scaffolding&amp;quot; views of your LINQ to SQL and LINQ to Entities data models.  Dynamic Data projects include template pages and user controls that can automatically create built-in data browsing/editing/selection/deleting UI that is dynamically constructed at runtime based on the LINQ to SQL or LINQ to Entities data model you've added to your project.
&lt;p&gt;To enable this auto-scaffolding support, open the web.config file of your project, search for the &amp;quot;dynamicData&amp;quot; section within it, and set the &amp;quot;enableTemplates&amp;quot; attribute to &amp;quot;true&amp;quot;:
&lt;p&gt;&lt;img src="http://www.scottgu.com/blogposts/dynamicdata/step10.png"&gt; 
&lt;p&gt;&lt;em&gt;Note: this auto-scaffolding feature is currently turned off by default for security reasons (we want you to be explicit about turning it on).  &lt;/em&gt;
&lt;p&gt;&lt;em&gt;Note: as you can see above, the ASP.NET dynamic data section provides optional URL mapping support that allows you to customize the URLs for your dynamic scaffold pages to be in whatever URL format you want.&lt;/em&gt;
&lt;h4&gt;&lt;u&gt;Step 4: Run Your Site&lt;/u&gt;&lt;/h4&gt;
&lt;p&gt;Hit F5 to run your project.  You'll by default be taken to a default.aspx page that lists all of the table objects in your data model:
&lt;p&gt;&lt;img src="http://www.scottgu.com/blogposts/dynamicdata/step3.png"&gt; 
&lt;p&gt;&lt;em&gt;Note: the default.aspx home-page is in the project - if you don't like how it looks just open it up and edit it however you want.&lt;/em&gt;
&lt;p&gt;Clicking on any of the table names in the list above will take you to a dynamic data page that lists the data within it:
&lt;p&gt;&lt;img src="http://www.scottgu.com/blogposts/dynamicdata/step4.png"&gt; 
&lt;p&gt;The default data view pages automatically create functional data navigation UI that includes built-in data paging and editing support (and are ASP.NET AJAX enabled):
&lt;p&gt;&lt;img src="http://www.scottgu.com/blogposts/dynamicdata/step6.png"&gt; 
&lt;p&gt;The data view pages automatically infer relationships between your related objects and provide automatic filtering support:
&lt;p&gt;&lt;img src="http://www.scottgu.com/blogposts/dynamicdata/step5.png"&gt; 
&lt;p&gt;The data view pages also automatically show relationships between your objects and allow users to easily navigate amongst them.  For example, notice how the Category column for products allows me to navigate to the category details for a specific product:
&lt;p&gt;&lt;img src="http://www.scottgu.com/blogposts/dynamicdata/step14.png"&gt; 
&lt;p&gt;The data view pages also enable automatic selection, editing and delete support.  Notice below how when in inline edit mode they automatically infer friendly foreign key names (allowing you to edit the &amp;quot;Category&amp;quot; and pick a name from a dropdownlist instead of having to specify a &amp;quot;CategoryID&amp;quot; integer): 
&lt;p&gt;&lt;img src="http://www.scottgu.com/blogposts/dynamicdata/step11.png"&gt; 
&lt;p&gt;All of this works without having to create a single custom .aspx page or write any custom code.  All of the web UI is created dynamically off of your LINQ to SQL or LINQ to Entities data model.
&lt;h4&gt;&lt;u&gt;Step 5: Customizing the Site Further&lt;/u&gt;&lt;/h4&gt;
&lt;p&gt;Having all of the above functionality work out of the box against your ORM data model is great for quickly getting your site up and running.  Once you get the basic site experience working, you can optionally go in and fully customize it - both at the data validation/business logic level as well as at the UI layer.
&lt;p&gt;You can add standard LINQ to SQL data model and business validation rules to your data model in order to enforce constraints.  The dynamic data pages will automatically work off of this logic, and provide appropriate error messages and validation UI based on them.  
&lt;p&gt;You can also optionally go in and customize the UI of any of the data pages you want.  Dynamic data projects allow you to customize the default look and feel of all data pages on the site, as well as customize the default look and feel of all column types used on the site.  You can customize both of these via the default template files added under the &amp;quot;/App_Shared&amp;quot; folder when you create a new dynamic data project:
&lt;p&gt;&lt;img src="http://www.scottgu.com/blogposts/dynamicdata/step12.png"&gt; 
&lt;p&gt;Simply edit any of the files above to customize the default data page views and/or default data column appearances.  
&lt;p&gt;You can also then optionally override the UI of specific data view pages by explicitly adding a .aspx page that maps to it in your project.  For example, I could override the default ListDetails behavior for Products by adding a \Products\ListDetails.aspx page to my project:
&lt;p&gt;&lt;img src="http://www.scottgu.com/blogposts/dynamicdata/step13.png"&gt; 
&lt;p&gt;You can then add any standard ASP.NET data control to the page.  You can also use the new dynamic data aware ASP.NET data controls that ship in the ASP.NET 3.5 Extensions CTP to the page.  These allow you to completely customize the look and feel of the UI - while still using the new dynamic meta-data provider to infer relationships and meta-data about your data model classes for default behavior.&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-5487770763778616419&amp;page=RSS%3a+%e5%85%b3%e4%ba%8e%e5%8a%a8%e6%80%81%e6%95%b0%e6%8d%ae%e7%9a%84%e6%96%b0%e5%8a%9f%e8%83%bd-ASP.NET3.5&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=aspnet.spaces.live.com&amp;amp;GT1=aspnet"&gt;</description><comments>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!522.entry#comment</comments><guid isPermaLink="true">http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!522.entry</guid><pubDate>Fri, 14 Dec 2007 11:20:54 GMT</pubDate><slash:comments>2</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://aspnet.spaces.live.com/blog/cns!B3D78590D833939D!522/comments/feed.rss</wfw:commentRss><wfw:comment>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!522.entry#comment</wfw:comment><dcterms:modified>2007-12-14T11:20:54Z</dcterms:modified></item><item><title>Try Visual Studio 2008</title><link>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!517.entry</link><description>&lt;table cellspacing=2 cellpadding=10 width="100%" border=0&gt;
&lt;tbody&gt;
&lt;tr valign=top align=left&gt;
&lt;td&gt;&lt;a href="http://images.google.cn/imgres?imgurl=http://www.msuniversity.edu.cn/upload/aa700830_VS2008hero_2.png&amp;amp;imgrefurl=http://www.msuniversity.edu.cn/m_NewsCenter/Detail.aspx%3Fid%3D654&amp;amp;h=210&amp;amp;w=565&amp;amp;sz=226&amp;amp;hl=zh-CN&amp;amp;start=35&amp;amp;tbnid=JYWg6veOwFaztM:&amp;amp;tbnh=50&amp;amp;tbnw=134&amp;amp;prev=/images%3Fq%3DVisual%2BStudio%2B2008%26start%3D20%26gbv%3D2%26ndsp%3D20%26svnum%3D10%26complete%3D1%26hl%3Dzh-CN%26newwindow%3D1%26sa%3DN" target="_blank"&gt;&lt;img style="border-right:1px solid;border-top:1px solid;border-left:1px solid;border-bottom:1px solid" height=50 src="http://tbn0.google.cn/images?q=tbn:JYWg6veOwFaztM:" width=134&gt;&lt;/a&gt;
&lt;td&gt;
&lt;h1&gt;Try Visual Studio 2008&lt;/h1&gt;
&lt;p&gt;Microsoft Visual Studio 2008 provides an industry-leading developer experience for Windows Vista, the 2007 Microsoft Office system, and the Web. In addition, it continues in the Microsoft tradition of development language innovation. To enable evaluation of Visual Studio 2008, this page provides links to trial versions of Visual Studio 2008. For more information, see &lt;a href="http://go.microsoft.com/?linkid=7773350"&gt;&lt;u&gt;&lt;font color="#0000ff"&gt;Visual Studio 2008 Product Information&lt;/font&gt;&lt;/u&gt;&lt;/a&gt;.
&lt;h3&gt;90-Day Trial Downloads&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Visual Studio 2008 Professional Edition (Coming Soon)&lt;/em&gt; 
&lt;li&gt;&lt;a href="http://go.microsoft.com/?linkid=7755932"&gt;&lt;u&gt;&lt;font color="#0000ff"&gt;Visual Studio Team System 2008 Team Suite&lt;/font&gt;&lt;/u&gt;&lt;/a&gt; 
&lt;li&gt;&lt;a href="http://go.microsoft.com/?linkid=7755933"&gt;&lt;u&gt;&lt;font color="#0000ff"&gt;Visual Studio Team System 2008 Team Foundation Server&lt;/font&gt;&lt;/u&gt;&lt;/a&gt; 
&lt;li&gt;&lt;a href="http://go.microsoft.com/?linkid=7755936"&gt;&lt;u&gt;&lt;font color="#0000ff"&gt;Visual Studio Team System 2008 Test Load Agent&lt;/font&gt;&lt;/u&gt;&lt;/a&gt;&lt;/ul&gt;
&lt;p&gt;Current MSDN Professional and Premium Subscribers can download Visual Studio 2008 from &lt;a href="http://aspnet.spaces.live.com/subscriptions"&gt;&lt;u&gt;&lt;font color="#0000ff"&gt;MSDN Subscriber Downloads&lt;/font&gt;&lt;/u&gt;&lt;/a&gt;.
&lt;p&gt;In addition, you can download the free &lt;a href="http://www.microsoft.com/express"&gt;&lt;u&gt;&lt;font color="#0000ff"&gt;Visual Studio 2008 Express Editions&lt;/font&gt;&lt;/u&gt;&lt;/a&gt; and &lt;a href="http://go.microsoft.com/?linkid=7755937"&gt;&lt;u&gt;&lt;font color="#0000ff"&gt;Microsoft .NET Framework 3.5&lt;/font&gt;&lt;/u&gt;&lt;/a&gt;.&lt;/tbody&gt;&lt;/table&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-5487770763778616419&amp;page=RSS%3a+Try+Visual+Studio+2008&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=aspnet.spaces.live.com&amp;amp;GT1=aspnet"&gt;</description><comments>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!517.entry#comment</comments><guid isPermaLink="true">http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!517.entry</guid><pubDate>Mon, 26 Nov 2007 09:19:44 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://aspnet.spaces.live.com/blog/cns!B3D78590D833939D!517/comments/feed.rss</wfw:commentRss><wfw:comment>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!517.entry#comment</wfw:comment><dcterms:modified>2007-11-26T09:19:44Z</dcterms:modified></item><item><title>Upgrading your ZUNE 1(EST AM 2:30 USA)</title><link>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!516.entry</link><description>&lt;div&gt;
&lt;p&gt;For you Zune 30 owners out there, today(EST AM 2:30 USA) you'll be getting the firmware update (woot). Our buddy &lt;a href="http://www.zunethoughts.com/news/show/23466/zune-30-firmware-update-old-is-made-new.html" target="_blank"&gt;&lt;u&gt;&lt;font color="#810081"&gt;Jason at Zune Thoughts produced a video&lt;/font&gt;&lt;/u&gt;&lt;/a&gt; detailing the upgrade experience. Check it out: 
&lt;p&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-5487770763778616419&amp;page=RSS%3a+Upgrading+your+ZUNE+1(EST+AM+2%3a30+USA)&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=aspnet.spaces.live.com&amp;amp;GT1=aspnet"&gt;</description><comments>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!516.entry#comment</comments><guid isPermaLink="true">http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!516.entry</guid><pubDate>Tue, 13 Nov 2007 12:48:33 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://aspnet.spaces.live.com/blog/cns!B3D78590D833939D!516/comments/feed.rss</wfw:commentRss><wfw:comment>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!516.entry#comment</wfw:comment><dcterms:modified>2007-11-13T12:48:33Z</dcterms:modified></item><item><title>嫦娥卫星的技术花絮</title><link>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!514.entry</link><description>&lt;div&gt;
&lt;div&gt;最近大家都关心嫦娥，今天粘贴点关于嫦娥卫星的技术信息。&lt;/div&gt;
&lt;div&gt;FYI FROM &lt;a href="http://aspnet.spaces.live.com/mmm2007-10-25_18.59/profile-uid-3152.html" target="_blank"&gt;&lt;u&gt;&lt;font color="#0000ff"&gt;YaoFei&lt;/font&gt;&lt;/u&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;对于地面使用的软件，特别是大家在电视上看到的每个人面前的监视终端，是一台运行在Windows2000上的普通PC机，监视软件也是普通的VC编写的，各个型号基本都差不多，在一套代码基础上按照每个型号的遥测处理格式和要求略有一些定制。&lt;br&gt;大部分软件体制还是脱胎于西安。真正的发指令和接收数据还是靠西安在干活。&lt;br&gt;型号研制单位自己的测试系统和软件不在此范围内，各种花样都有，运行在自己的总装总测场地。&lt;br&gt;&lt;br&gt;至于星上的软件，仅对嫦娥而言，主要的数管和姿控导航两个分系统各自使用了一台基于欧洲ERC32处理器的计算机，主频不超过30MHz, 没有通常意义的操作系统，在RTEMS的基础上大幅度剪裁剩下一点点残渣作为底层的硬件和进程管理，上面跑自己的应用软件完成功能。编译器是erc32ccs,  GCC的定制版本，支持SPARC V7处理器和RTEMS， ESA提供的，高兴了可以去免费下载玩玩.   有效载荷软件大部分都是基于MCS51的单片机系统，个别设备也许有DSP.&lt;br&gt;由于前段时间发生了用导弹摧毁FY-1C卫星的事情，国际上已经完全不相信中国所谓气象卫星是民用项目的幌子，给了各种本来就对中国存在敌意的国家和组织以口实，现在想继续买ERC32和欧洲生产的其他星载处理器已经几乎完全没有可能，美国就更不要说了。一些后续型号基本上面临无米下锅的难题。&lt;img title="" style="width:399px;height:176px" src="http://images.china.cn/attachement/jpg/site1000/20070928/0019b91ecb6d0866982602.jpg" align=center border=0&gt;&lt;/div&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-5487770763778616419&amp;page=RSS%3a+%e5%ab%a6%e5%a8%a5%e5%8d%ab%e6%98%9f%e7%9a%84%e6%8a%80%e6%9c%af%e8%8a%b1%e7%b5%ae&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=aspnet.spaces.live.com&amp;amp;GT1=aspnet"&gt;</description><comments>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!514.entry#comment</comments><guid isPermaLink="true">http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!514.entry</guid><pubDate>Tue, 06 Nov 2007 10:46:32 GMT</pubDate><slash:comments>1</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://aspnet.spaces.live.com/blog/cns!B3D78590D833939D!514/comments/feed.rss</wfw:commentRss><wfw:comment>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!514.entry#comment</wfw:comment><dcterms:modified>2007-11-06T10:46:32Z</dcterms:modified></item><item><title>一些IIS的小提示(针对1.0,1.1的用户)</title><link>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!482.entry</link><description>&lt;p&gt;IIS的修复
&lt;p&gt;&lt;font color="#ff0000"&gt;&lt;strong&gt;注意:此法只是针对1.0,1.1的用户.&lt;/strong&gt;&lt;/font&gt;
&lt;p&gt;一般IIS运行不了ASP.NET,试一下下面四种方法，99％有效： &lt;br&gt;1。.NET 安装的顺序应该是先装IIS，再装VS.NET，如果次序反了，或者IIS重装了，就需要使用aspnet_regiis.exe -i来重新安装IIS Mapping（主要用于aspx, asmx等文件的Extention的匹配）。在C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705目录下，运行下面的命令：aspnet_regiis.exe -i &lt;br&gt;2。重设ASPNET的密码，然后在下面的目录中找到Machine.config文件：%Systemroot%\Microsoft.NET\Framework\v1.0.3705\CONFIG （Systemroot是你的安装目录），在&amp;lt;processModel&amp;gt;标识中添加/修改：userName和password3。如果还不行，重装IIS，然后再按照方法1进行操作4。如果你的机器是域控制器，你可以参考Q315158：ASP.NET Does Not Work withASPNET Account on Domain Controller,大致讲一下操作的步骤： &lt;br&gt;1。在Administrative Tools-&amp;gt;Active Directory Users and Computers中建立一个名为ASPUSER的用户，将该用户添加到用户组中（默认情况下已在User Group中） &lt;br&gt;2。在Administrative Tools-&amp;gt;Local Security Settings－&amp;gt;Local Policy-&amp;gt;UserRight Assignment中,双击右栏的Log on as a batch job项，在弹出的窗口中点击Add，选择或输入刚才建立的ASPUSER帐号，确定。（需要重启机器） &lt;br&gt;3。确保ASPUSER帐号有相应文件、目录的访问权限4。在下面的目录中找到Machine.config文件：%Systemroot%\Microsoft.NET\Framework\v1.0.3705\CONFIG （Systemroot是你的安装目录），在&amp;lt;processModel&amp;gt;标识中添加/修改：userName=&amp;quot;DomainName\ASPUSER&amp;quot; password=&amp;quot;ASPUSERpassword&amp;quot; 其中ASPUSERpassword是刚刚建立的ASPUSER的密码，DomainName是你的域名 （重启机器）应该OK了！ 
&lt;div&gt; &lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-5487770763778616419&amp;page=RSS%3a+%e4%b8%80%e4%ba%9bIIS%e7%9a%84%e5%b0%8f%e6%8f%90%e7%a4%ba(%e9%92%88%e5%af%b91.0%2c1.1%e7%9a%84%e7%94%a8%e6%88%b7)&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=aspnet.spaces.live.com&amp;amp;GT1=aspnet"&gt;</description><comments>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!482.entry#comment</comments><guid isPermaLink="true">http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!482.entry</guid><pubDate>Wed, 25 Jul 2007 02:34:54 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://aspnet.spaces.live.com/blog/cns!B3D78590D833939D!482/comments/feed.rss</wfw:commentRss><wfw:comment>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!482.entry#comment</wfw:comment><dcterms:modified>2007-07-25T02:34:54Z</dcterms:modified></item><item><title>ASP.NET 3.5(vs2008)之嵌套母板页</title><link>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!475.entry</link><description>&lt;div&gt;this article came from scottgu.&lt;/div&gt;
&lt;div&gt;&amp;quot;Master Page&amp;quot; support was one of the most popular features introduced with ASP.NET 2.0, and is one of those features that almost every new ASP.NET project now uses to deliver consistent layout template support across a web site.One of the cooler scenarios that ASP.NET 2.0 supports is the ability to have &amp;quot;nested master pages&amp;quot; - where you can create a root master page for a site that defines a site's overall layout, and then create nested master pages that are based on the root master and further customize the layout (for example: you could create a SingleColumn.Master and TwoColumn.Master that defined 1 or 2 column layout structures based on the root master template).  This nested master page feature is extremely flexible, and enables developers and designers to quickly and very cleanly make changes to the layout and organization of a site with minimal code changes and no content duplication.  The one (big) catch, though, is that Visual Studio 2005 doesn't really support using nested master pages, and pages based on nested masters can't be edited within the VS 2005 WYSIWYG designer.  The good news is that VS 2008 fully supports nested master pages, and makes using them super easy.  Going forward I recommend that almost all ASP.NET projects should advantage of this feature - since it can add tremendous flexibility to the UI of your projects.
&lt;h3&gt;&lt;u&gt;Using Nested Master Pages With VS 2008&lt;/u&gt;&lt;/h3&gt;
&lt;p&gt;One of the sites I recommend checking out is &lt;a title="http://www.opensourcetemplates.org/" href="http://www.opensourcetemplates.org/" target="_blank"&gt;&lt;u&gt;&lt;font color="#0000ff"&gt;http://www.opensourcetemplates.org/&lt;/font&gt;&lt;/u&gt;&lt;/a&gt;.  This is an online repository of free HTML site templates that you can browse, download and use.  The templates on the site are pure HTML (meaning you can use them with any server-side programming technology), and are built using clean CSS and XHTML markup:
&lt;p&gt;&lt;img src="http://www.scottgu.com/blogposts/nested/step1.jpg"&gt; 
&lt;p&gt;To help with this blog post, I picked one of the templates that I thought looked nice.  You can browse it online &lt;a href="http://www.opensourcetemplates.org/templates/preview.php?template_id=1054723136" target="_blank"&gt;&lt;u&gt;&lt;font color="#0000ff"&gt;here&lt;/font&gt;&lt;/u&gt;&lt;/a&gt;, and download it &lt;a href="http://www.opensourcetemplates.org/templates/download.php?template_id=1054723136" target="_blank"&gt;&lt;u&gt;&lt;font color="#0000ff"&gt;here&lt;/font&gt;&lt;/u&gt;&lt;/a&gt;.  
&lt;p&gt;Like most web-sites out there, this template has pages that utilize a few different layout approaches for displaying content.  For example, it includes a page that uses multiple-columns to layout content:
&lt;p&gt;&lt;img src="http://www.scottgu.com/blogposts/nested/step2.jpg"&gt; 
&lt;p&gt;It also has pages that use a single column approach that fills the entire width of the page with content:
&lt;p&gt;&lt;img src="http://www.scottgu.com/blogposts/nested/step3.jpg"&gt; 
&lt;h3&gt;&lt;u&gt;Using the Above HTML/CSS Template with Nested Master Pages&lt;/u&gt;&lt;/h3&gt;
&lt;p&gt;Converting the above template to use ASP.NET and its nested Master Page support is really easy with VS 2008.  
&lt;p&gt;&lt;u&gt;Step 1: Create a Site.Master template&lt;/u&gt;
&lt;p&gt;To begin with we can create a new root master page file that we'll use to define the overall layout and structure for all pages on the site.  We'll name this file &amp;quot;Site.Master&amp;quot; and copy/paste the &amp;quot;outer chrome&amp;quot; HTML from the template we downloaded into it.  We'll then add a &amp;lt;asp:contentplaceholder&amp;gt; into the content section in the middle where we'll fill in page specific content.  We'll name this &amp;lt;asp:contentplaceholder&amp;gt; control &amp;quot;MainContent&amp;quot;:
&lt;p&gt;&lt;img src="http://www.scottgu.com/blogposts/nested/step4.jpg"&gt; 
&lt;p&gt;&lt;u&gt;Step 2: Create SingleColumn.Master Template&lt;/u&gt;
&lt;p&gt;We used our Site.Master template above to define the &amp;quot;outer chrome template&amp;quot; of the site we are working on.  We'll now want to create a few nested master pages that provide further templates that customize the layout of the &amp;quot;MainContent&amp;quot; section.
&lt;p&gt;To do this we can right-click in the solution explorer and choose the &amp;quot;Add New Item&amp;quot; menu option.  We'll create a new Master Page called &amp;quot;SingleColumn.Master&amp;quot; and will want to make sure that the checkbox indicating that we want to base this master page off a parent master page is selected:
&lt;p&gt;&lt;img src="http://www.scottgu.com/blogposts/nested/step5.jpg"&gt; 
&lt;p&gt;VS 2008 will then allow us to pick the Site.Master template as the master page we want to base this new SingleColumn.master template on:
&lt;p&gt;&lt;img src="http://www.scottgu.com/blogposts/nested/step6.jpg"&gt; 
&lt;p&gt;VS 2008 will then create a new SingleColumn.master file that looks like below:
&lt;p&gt;&lt;img src="http://www.scottgu.com/blogposts/nested/step7.jpg"&gt; 
&lt;p&gt;Notice above how VS 2008 has picked up the fact that we defined a &amp;lt;asp:contentplaceholder&amp;gt; control in the root Site.Master file called &amp;quot;MainContent&amp;quot; - and automatically added a blank &amp;lt;asp:content&amp;gt; control within this nested master page so that we can override and customize that content region...
&lt;p&gt;more details:
&lt;p&gt;&lt;a href="http://weblogs.asp.net/scottgu/archive/2007/07/09/vs-2008-nested-master-page-support.aspx"&gt;http://weblogs.asp.net/scottgu/archive/2007/07/09/vs-2008-nested-master-page-support.aspx&lt;/a&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-5487770763778616419&amp;page=RSS%3a+ASP.NET+3.5(vs2008)%e4%b9%8b%e5%b5%8c%e5%a5%97%e6%af%8d%e6%9d%bf%e9%a1%b5&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=aspnet.spaces.live.com&amp;amp;GT1=aspnet"&gt;</description><comments>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!475.entry#comment</comments><guid isPermaLink="true">http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!475.entry</guid><pubDate>Thu, 12 Jul 2007 21:58:23 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://aspnet.spaces.live.com/blog/cns!B3D78590D833939D!475/comments/feed.rss</wfw:commentRss><wfw:comment>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!475.entry#comment</wfw:comment><dcterms:modified>2007-07-12T21:58:23Z</dcterms:modified></item><item><title>搞计算机该学习的基础</title><link>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!460.entry</link><description>&lt;div&gt;数据结构   &lt;/div&gt;
&lt;div&gt;操作系统   &lt;br&gt;Ｃ＋＋  算法    &lt;br&gt;离散数学 &lt;/div&gt;
&lt;div&gt;软件工程&lt;/div&gt;
&lt;div&gt;数据库&lt;/div&gt;
&lt;div&gt;计算机网络 &lt;/div&gt;
&lt;div&gt;计算机组成原理 &lt;/div&gt;
&lt;div&gt;没有一项和具体的公司商业技术有关，从这点就说明何谓计算机科学。&lt;strong&gt;&lt;em&gt;&lt;font size=4&gt;公司商业技术只是一种社会行为的结果。&lt;/font&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-5487770763778616419&amp;page=RSS%3a+%e6%90%9e%e8%ae%a1%e7%ae%97%e6%9c%ba%e8%af%a5%e5%ad%a6%e4%b9%a0%e7%9a%84%e5%9f%ba%e7%a1%80&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=aspnet.spaces.live.com&amp;amp;GT1=aspnet"&gt;</description><comments>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!460.entry#comment</comments><guid isPermaLink="true">http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!460.entry</guid><pubDate>Wed, 27 Jun 2007 21:32:28 GMT</pubDate><slash:comments>2</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://aspnet.spaces.live.com/blog/cns!B3D78590D833939D!460/comments/feed.rss</wfw:commentRss><wfw:comment>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!460.entry#comment</wfw:comment><dcterms:modified>2007-06-27T21:34:19Z</dcterms:modified></item><item><title>隔夜茶</title><link>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!423.entry</link><description>&lt;div&gt;最近晚上为赶个文档,经常通宵.但喝的茶却是上一天白天所泡,我这种喝法到底算不算隔夜茶啊?隔夜茶有毒啊,我一直对这个问题很疑惑和郁闷..&lt;br&gt;上等铁观音啊...&lt;/div&gt;
&lt;div&gt;另外帮人代招一个白盒测试职位(要求马上去美国)，感兴趣的可以给我邮件:要求如下:&lt;/div&gt;
&lt;div&gt;Expert on C#/C++. 2 to 3+ years software developing experience. &lt;br&gt;Skillful with networking and Active Directory.&lt;br&gt;1 year experience working in a Windows client/server environment.&lt;br&gt;1 year development and/or database administration experience using a Microsoft product or Microsoft technologies. &lt;br&gt;Database programming experience i.e. SQL Server, Sybase. &lt;br&gt;Bachelor degree in Computer Science and some business/functional knowledge are helpful. &lt;br&gt;&lt;strong&gt;Familiarity with Windows Vista is a help&lt;/strong&gt;&lt;br&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-5487770763778616419&amp;page=RSS%3a+%e9%9a%94%e5%a4%9c%e8%8c%b6&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=aspnet.spaces.live.com&amp;amp;GT1=aspnet"&gt;</description><comments>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!423.entry#comment</comments><guid isPermaLink="true">http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!423.entry</guid><pubDate>Fri, 04 May 2007 22:25:28 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://aspnet.spaces.live.com/blog/cns!B3D78590D833939D!423/comments/feed.rss</wfw:commentRss><wfw:comment>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!423.entry#comment</wfw:comment><dcterms:modified>2007-05-04T22:25:28Z</dcterms:modified></item><item><title>搞笑的VISTA安装</title><link>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!409.entry</link><description>&lt;div&gt;2006-2007第3次安装VISTA,这次与以往不同,使用VPC2007.出现的问题很搞笑,无法定义硬盘大小,只能采用它默认的64G.....&lt;/div&gt;
&lt;div&gt;其实我只有8.7G的剩余空间,居然只能按照64G才能无出错安装!&lt;/div&gt;
&lt;div&gt;这种大错误可能导致严重的数据丢失,文件目录索引混乱,存储边界不清,蓝屏等...&lt;/div&gt;
&lt;div&gt;这次先凑合用,下次有时间必须重新安装一下.&lt;/div&gt;
&lt;div&gt;上图:&lt;/div&gt;
&lt;div&gt;&lt;img src="http://byfiles.storage.msn.com/x1pjzF2-RYhxRWYxqPGHE6XwXAVrpze_H2ltlS0qN1Lztu43-zrasvNJJVhEYCbzE8FTPhTg3cvzeCeCjCmh2xQ1HNrOsYt3P9WNqzET3LhnwAJS_nvw0hPGA"&gt;&lt;/div&gt;&lt;div&gt;&lt;table cellspacing="0" border="0"&gt;&lt;tr height="8"&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;p&gt;&lt;a href="http://byfiles.storage.live.com&amp;#47;y1p35eT6C37t_faA3NVdjx_bFgtDGvADAU65V5VAJieLfbLz9PK-Cxs_Q"&gt;&lt;img src="http://storage.live.com&amp;#47;items&amp;#47;B3D78590D833939D&amp;#33;410&amp;#58;thumbnail" border="0"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/td&gt;&lt;td width="15"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-5487770763778616419&amp;page=RSS%3a+%e6%90%9e%e7%ac%91%e7%9a%84VISTA%e5%ae%89%e8%a3%85&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=aspnet.spaces.live.com&amp;amp;GT1=aspnet"&gt;</description><comments>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!409.entry#comment</comments><guid isPermaLink="true">http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!409.entry</guid><pubDate>Sun, 15 Apr 2007 16:22:17 GMT</pubDate><slash:comments>1</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://aspnet.spaces.live.com/blog/cns!B3D78590D833939D!409/comments/feed.rss</wfw:commentRss><wfw:comment>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!409.entry#comment</wfw:comment><dcterms:modified>2007-04-15T16:22:17Z</dcterms:modified></item><item><title>深夜随笔(2)</title><link>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!397.entry</link><description>&lt;div&gt;没想到,没想到......今天居然为搞一个爬数据的机器人弄到现在!&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;起因:&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;某网站数据对我有至关重要的作用,经过分析其结构和漏洞决定编写一个爬数据的机器人.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;BTW:我这个机器人很简陋,很粗鲁,很占用该网站服务器的资源.希望08年某个时候需要和我同时一起查看信息的朋友别怪我,我感觉有点愧疚&lt;/div&gt;
&lt;div&gt;:(&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;strong&gt;过程:&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;Coding.....&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;strong&gt;总结&lt;/strong&gt;:&lt;/div&gt;
&lt;div&gt;好久没写了,光动嘴了....感觉没以前猛了,有点发生了....&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;自我批评:明天一定早点睡觉,找回状态继续&lt;strong&gt;&lt;em&gt;&lt;font size=4&gt;&amp;quot;扬短避长&amp;quot;,&lt;/font&gt;&lt;/em&gt;&lt;/strong&gt;我已经被兄弟给我的书压死了.....&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;再次感谢周兄的无私...敬礼!&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-5487770763778616419&amp;page=RSS%3a+%e6%b7%b1%e5%a4%9c%e9%9a%8f%e7%ac%94(2)&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=aspnet.spaces.live.com&amp;amp;GT1=aspnet"&gt;</description><comments>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!397.entry#comment</comments><guid isPermaLink="true">http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!397.entry</guid><pubDate>Sat, 07 Apr 2007 19:53:22 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://aspnet.spaces.live.com/blog/cns!B3D78590D833939D!397/comments/feed.rss</wfw:commentRss><wfw:comment>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!397.entry#comment</wfw:comment><dcterms:modified>2007-04-07T20:08:59Z</dcterms:modified></item><item><title>ViewState(from dotnetbips)</title><link>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!393.entry</link><description>&lt;div&gt;
&lt;h3&gt;Improve performance by compressing ViewState&lt;/h3&gt;
&lt;h4&gt;Introduction&lt;/h4&gt;
&lt;p&gt;Developers often worry about performance of their web sites. Every developer wants that his web site be optimized for good performance. There are several factors affecting performance of your web site and one of them is ViewState. In this article I am going to show a way by which you can compress ViewState thus improving the performance. 
&lt;h4&gt;What is ViewState?&lt;/h4&gt;Though this article is not intended to illustrate what ViewState is let's quickly discuss it. If you see HTML source of your web forms you will find a hidden form field named __VIEWSTATE. Clever &lt;a style="text-decoration:underline! important" href="http://www.dotnetbips.com/articles/22d33d11-1a75-42c8-bbf6-ca1a345d3fcf.aspx#"&gt;&lt;font style="font-weight:400;font-size:10pt;color:#009900! important;font-family:Verdana" color="#009900"&gt;&lt;span style="font-weight:400;font-size:10pt;color:#009900! important;font-family:Verdana"&gt;ASP&lt;/span&gt;&lt;/font&gt;&lt;/a&gt;.NET persists control values in this hidden field helping you to preserve them across post backs. No doubt ViewState is helpful. However, at times ViewState can create performance issues. Since ViewState is transferred between browser and server with each request it adds to network bandwidth. 
&lt;p&gt;
&lt;p&gt;One way to reduce the ViewState data flowing over the wire is to turn ViewState off. All the web server controls have a property called EnableViewState. Setting this property to false will disable ViewState for that control. However, without ViewState all the job of state persistence comes on your shoulders and can be painful at times. Another option, which the theme of this article, is to compress the ViewState before serializing it on the network. This way the amount of data on the wire will be substantially less. 
&lt;p&gt;In ASP.NET 1.x people used this compression technique with custom code because there was no inbuilt way. The .NET 2.0, however, makes your life easy by providing System.IO.Compression namespace. The GZipStream class from System.IO.Compression comes handy in compressing and decompressing streams. Note that GZipStream works with only one stream at a time. The GZipStream class is not specifically designed for ViewState as such but we are going to harness its functionality for compressing and decompressing ViewState. 
&lt;h4&gt;Creating ViewStateHelper&lt;/h4&gt;
&lt;p&gt;To begin with, &lt;a style="text-decoration:underline! important" href="http://www.dotnetbips.com/articles/22d33d11-1a75-42c8-bbf6-ca1a345d3fcf.aspx#"&gt;&lt;font style="font-weight:400;font-size:10pt;color:#009900! important;font-family:Verdana" color="#009900"&gt;&lt;span style="font-weight:400;font-size:10pt;color:#009900! important;font-family:Verdana"&gt;create &lt;/span&gt;&lt;span style="font-weight:400;font-size:10pt;color:#009900! important;font-family:Verdana"&gt;a &lt;/span&gt;&lt;span style="font-weight:400;font-size:10pt;color:#009900! important;font-family:Verdana"&gt;new &lt;/span&gt;&lt;span style="font-weight:400;font-size:10pt;color:#009900! important;font-family:Verdana"&gt;web &lt;/span&gt;&lt;span style="font-weight:400;font-size:10pt;color:#009900! important;font-family:Verdana"&gt;site&lt;/span&gt;&lt;/font&gt;&lt;/a&gt; using Visual Studio. Then add a class called ViewStateHelper in its App_Code folder. At the top of the class import namespaces as shown below: &lt;pre&gt;using System.IO;
using System.IO.Compression;
&lt;/pre&gt;
&lt;p&gt;The System.IO namespace provides stream classes such as MemoryStream. The System.IO.Compression namespace provides GZipStream class that allows you to represent data in gzip format (RFC 1952). 
&lt;h5&gt;Compressing data&lt;/h5&gt;
&lt;p&gt;Now add a method called Compress() as shown below:&lt;pre&gt;public static byte[] Compress(byte[] data)
{
MemoryStream ms = new MemoryStream();
GZipStream stream = new GZipStream
(ms, CompressionMode.Compress);
stream.Write(data, 0, data.Length);
stream.Close();
return ms.ToArray();
}
&lt;/pre&gt;
&lt;p&gt;The Compress() static method accepts a byte array to be compressed and returns compressed byte array. It creates an instance of MemoryStream class. The MemoryStream class represents a stream in memory. It then creates GZipStream object by passing MemoryStream and compression mode of Compress. Instead of MemoryStream you could have passed any type of stream. The compressed data is written to this stream. The Write() method of GZipStream class accepts a byte array, compresses it and writes it to the supplied stream (MEmoryStream in our case). After writing the data GZipStream is closed. Finally, ToArray() method of MemoryStream class converts the underlying stream data into byte array. 
&lt;h5&gt;Decompressing data&lt;/h5&gt;
&lt;p&gt;In order to decompress data add another method called Decompress() and key in the following code in it:&lt;pre&gt;public static byte[] Decompress(byte[] data)
{
MemoryStream ms = new MemoryStream();
ms.Write(data, 0, data.Length);
ms.Position = 0;
GZipStream stream = new GZipStream(ms, CompressionMode.Decompress);
MemoryStream temp = new MemoryStream();
byte[] buffer=new byte[1024];
while (true)
{
int read = stream.Read(buffer, 0, buffer.Length);
if (read &amp;lt;= 0)
{
break;
}
else
{
temp.Write(buffer, 0, buffer.Length);
}
}
stream.Close();
return temp.ToArray();
}
&lt;/pre&gt;
&lt;p&gt;The Decompress() method accepts byte array of compressed data and returns its decompressed version. First, it creates a MemoryStream and writes compressed byte array to it. This stream is then supplied to GZipStream constructor. Notice that this time compression mode is Decompress. The decompressed data also needs to be stored somewhere. The code creates another MemoryStream for this purpose. A while loop reads decompressed data from GZipStream in the chunks of 1024 bytes at a time. This data is then written to the MemoryStream. Finally, GZipStream is closed and contents of decompressed MemoryStream are returned to the caller as byte array. 
&lt;p&gt;This completes the ViewStateHelper class. Now you need to put this class in use for compressing and decompressing ViewState. 
&lt;h4&gt;Creating a &lt;a style="text-decoration:underline! important" href="http://www.dotnetbips.com/articles/22d33d11-1a75-42c8-bbf6-ca1a345d3fcf.aspx#"&gt;&lt;font style="font-weight:700;color:#009900! important;font-family:Verdana" color="#009900"&gt;&lt;span style="font-weight:700;color:#009900! important;font-family:Verdana"&gt;web &lt;/span&gt;&lt;span style="font-weight:700;color:#009900! important;font-family:Verdana"&gt;form&lt;/span&gt;&lt;/font&gt;&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Now open the default web form and drag and drop one SQL Data Source control on it. Configure it to select all records from Customers table of Northwind database. &lt;img src="http://aspnet.spaces.live.com/mmm2007-02-10_13.26/content/images/528img01.jpg"&gt; 
&lt;p&gt;Drag and drop a GridView control and set its DataSourceID property to the ID of SQL Data Source control you just configured. Run the web form so as to ensure that it is working as expected. The following figure shows a sample run of the web form &lt;img src="http://aspnet.spaces.live.com/mmm2007-02-10_13.26/content/images/528img02.jpg"&gt; 
&lt;h4&gt;Customizing ViewState serialization&lt;/h4&gt;
&lt;p&gt;Most of the times you don't interfere with ViewState serialization and deserialization mechanism at all. However, since you wish to compress the ViewState you need to customize the way ViewState is serialized and deserialized. The Page base class has two virtual methods viz. SavePageStateToPersistenceMedium() and LoadPageStateFromPersistenceMedium(). Together they allow you to customize ViewState serialization and deserialization respectively. 
&lt;p&gt;Go in the code behind of the web form and override SavePageStateToPersistenceMedium() method first. You will compress ViewState and store it in a hidden variable in this method. The following code shows this method. &lt;pre&gt;protected override void 
SavePageStateToPersistenceMedium(object state)
{
LosFormatter formatter = new LosFormatter();
StringWriter writer = new StringWriter();
formatter.Serialize(writer, state);
string viewState = writer.ToString();
byte[] data = Convert.FromBase64String(viewState);
byte[] compressedData = ViewStateHelper.Compress(data);
string str = Convert.ToBase64String(compressedData);
ClientScript.RegisterHiddenField(&amp;quot;__MYVIEWSTATE&amp;quot;, str);
}
&lt;/pre&gt;
&lt;p&gt;The SavePageStateToPersistenceMedium() method accepts an object that represents the ViewState data. Inside it creates LosFormatter object. The LosFormatter class allows you to serialize and deserialize data in ViewState compatible format. The Serialize() method of LosFormatter class accepts a stream where data is to be serialized and the state object. In our example we serialize the data into a StringWriter. The ToString() method of StringWriter returns a string that represents ViewState data in string form. This string data is in Base64 format (this how ASP.NET stores the ViewState)and need to be converted into a plain string. The FromBase64String() method of Convert class does this job. The return value of FromBase64String() method is a byte array which is then compressed using Compress() method of ViewStateHelper class. The compressed byte array is again converted into its Base64 representation using ToBase64String() method of Convert class. Finally, a hidden field named __MYVIEWSTATE is emitted using RegisterHiddenField() method of ClientScript member with its value set to the compressed Base64 string. 
&lt;p&gt;Compressing ViewState data is just one side of the coin. Equally important is to decompress it back so that ASP.NET can work with it further. This is done by overriding LoadPageStateFromPersistenceMedium() method as shown below: &lt;pre&gt;protected override object 
LoadPageStateFromPersistenceMedium()
{
string viewstate = Request.Form[&amp;quot;__MYVIEWSTATE&amp;quot;];
byte[] data = Convert.FromBase64String(viewstate);
byte[] uncompressedData = 
ViewStateHelper.Decompress(data);
string str = Convert.ToBase64String
(uncompressedData);
LosFormatter formatter = new LosFormatter();
return formatter.Deserialize(str);
}
&lt;/pre&gt;
&lt;p&gt;The method retrieves __MYVIEWSTATE hidden field from Form collection. This field contains compressed version of the ViewState in Base64 format. In order to decompress it you need to convert it into a byte array first. This is done via FromBase64String() method of Convert class. Then Decompress() method of ViewStateHelper decompresses the data. The decompressed data is again converted into a Base64 string using ToBase64String() method of Convert class. Finally, LosFormatter instance deserializes the decompressed ViewState. 
&lt;p&gt;That's it! Your ViewState compression scheme is now ready. During my testing I observed that the uncompressed ViewState was 13,568 bytes whereas the compressed ViewState was 5,932 bytes. A great deal of saving. Isn't it? 
&lt;h4&gt;Summary&lt;/h4&gt;
&lt;p&gt;In this article you learnt to improve performance of your web forms by compressing ViewState data. The new GZipStream class offers a ready made way to compress data in gzip format. The compressed ViewState needs to be saved by overriding SavePageStateToPersistenceMedium() method of Page base class. Similarly, LoadPageStateFromPersistenceMedium() needs to be overridden for decompressing and loading the ViewState back. &lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-5487770763778616419&amp;page=RSS%3a+ViewState(from+dotnetbips)&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=aspnet.spaces.live.com&amp;amp;GT1=aspnet"&gt;</description><comments>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!393.entry#comment</comments><guid isPermaLink="true">http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!393.entry</guid><pubDate>Sun, 01 Apr 2007 07:50:26 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://aspnet.spaces.live.com/blog/cns!B3D78590D833939D!393/comments/feed.rss</wfw:commentRss><wfw:comment>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!393.entry#comment</wfw:comment><dcterms:modified>2007-04-01T07:50:26Z</dcterms:modified></item><item><title>程序员与现实生活(原创)</title><link>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!383.entry</link><description>&lt;div align=center&gt;&lt;strong&gt;&lt;font size=4&gt;程序员与现实生活(原创)&lt;/font&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div align=center&gt;&lt;strong&gt;                                                         作者:杨云(YunYang)&lt;/strong&gt;&lt;/div&gt;
&lt;div align=center&gt;&lt;strong&gt;                                                                                                         转载请注明出处:http://aspnet.spaces.live.com&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;经常听很多人讨论普通软件开发人员吃青春饭干不到30岁就要转行的讨论,一些人觉得真实,一些人反对.&lt;/div&gt;
&lt;div&gt;反对的人认为这是高技术行业,不是体力劳动,只要有技术可以干一辈子(这里叫反方).同意的人认为社会目前就是这个状况,过30就没人要.(这里叫正方).&lt;/div&gt;
&lt;div&gt;我觉得他们都忽略了2点:&lt;/div&gt;
&lt;div&gt;1.这里说的Coding或者软件开发一般商业性质的公司,商业行为.所使用的技术也都是依靠某个商业公司平台下的技术,比如Microsoft,Sun.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;2.这里说的Coding或者软件开发不是在做基础研究,只是商业开发.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;注意到没有,就凭借上面的2点,可以证明两方面都是有偏激的.真正没有这个天赋的人,一般在1年内甚至更短时间会被软件行业淘汰,不可能坚持那么长时间.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;先说第一点,既然作为一个在公司以打工为生的程序员,就需要时刻保持技术的新鲜.听起来很容易,做起来是很痛苦的,除了工作外要把几乎所有的业余时间砸在上面.作为一个普通程序员加班是家常便饭,有时间可能连续数月.... 这就不简单是个人问题了,程序员也是人,也要有时间和人接触,特别是结婚的同志们就不用说了,你老婆能理解你天天对着PC,不理她吗? 如果是大龄程序员压力就更大了,还要面对年轻人的冲击,要继续混下去只能选择时刻保持先进性...和和.&lt;/div&gt;
&lt;div&gt;如果你老婆或者女朋友理解你,支持你,只是默默的给你倒上一杯茶....恭喜你,你太有福了,你是幸运的,有家人的支持,你&lt;strong&gt;所向披靡!&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;按照我看到的,超过30岁的程序员无提升选择转行的,一般并不是因为没人要了,而是自己选择放弃.干不动了.....这个干不动有时也无奈,人精力有限的,高强度的工作性质加上要照顾家庭,甚至小孩,大部分人只能选择放弃....&lt;/div&gt;
&lt;div&gt;说自己有技术就可以干一辈子的,我们可以走着瞧,,是不是这样的....和和..不要嘴硬...&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;再说第二点,说自己过了30就没人要的或者不符合条件的.先不说技术是否跟上了,先说心理上有为你从事的行业去奋斗的决心吗?有不怕寂寞,敢于挑战困难的决心吗?面对周围人的不理解,骂你无能,说你呆傻,没时间找老婆的处境等..你能坚持吗?&lt;/div&gt;
&lt;div&gt;如果你能做到,我想不要说一个工作,就是做大师级的人物也只是时间问题.&lt;/div&gt;
&lt;div&gt;特别是持正方观点的人,其实外界给他们大压力是很大的.&lt;/div&gt;
&lt;div&gt;有谁见过机关公务员搞计算机的人说自己到30了,要转行了?有吗?我想没有,,,为何?道理很简单,没有太大压力,不管是自身还是来自单位都是.干的好干的坏一样拿工资吃饭.(就比如某单位的计算机处和网络检查处,,我几年前去实习过,我想读我文章的很多牛人的战斗力可以抵他们一个处的能力和工作量)&lt;/div&gt;
&lt;div&gt;请问.社会打工可以这样吗?你如果坚持要做,我上面列出的问题就是你要去解决的..你做的到吗?&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;说了那么多,其实就是要告诉大家,要做这个行业就好好做,这个行业是注定与孤单,黑夜相伴的.不想做就趁早转行,不需要找那么多理由,这不丢人.凭劳动吃饭到哪里都是大写的&amp;quot;人&amp;quot;.&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-5487770763778616419&amp;page=RSS%3a+%e7%a8%8b%e5%ba%8f%e5%91%98%e4%b8%8e%e7%8e%b0%e5%ae%9e%e7%94%9f%e6%b4%bb(%e5%8e%9f%e5%88%9b)&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=aspnet.spaces.live.com&amp;amp;GT1=aspnet"&gt;</description><comments>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!383.entry#comment</comments><guid isPermaLink="true">http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!383.entry</guid><pubDate>Wed, 07 Mar 2007 03:12:34 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://aspnet.spaces.live.com/blog/cns!B3D78590D833939D!383/comments/feed.rss</wfw:commentRss><wfw:comment>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!383.entry#comment</wfw:comment><dcterms:modified>2007-03-07T03:16:58Z</dcterms:modified></item><item><title>ASP.NET2.0 Page lifecycle(MasterPages)</title><link>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!363.entry</link><description>&lt;div&gt;
&lt;h2&gt;THIS DOCUMENT I PICK UP FROM CODEPROJECT,ITS IMPORTANT FOR .NET DEVELOPER.&lt;/h2&gt;&lt;strong&gt;SUMMARY:ASP.NET2.0 Page lifecycle,specially we use masterpage in our application.&lt;/strong&gt; 
&lt;p&gt;Introduction 
&lt;p&gt;Understanding Page lifecycle is very crucial in order to develop ASP.NET applications. Most beginners tend to get confused while dealing with dynamic controls and face problems like losing values, state etc on postbacks. Since &lt;strong&gt;HTTP is stateless&lt;/strong&gt;, the nature of web programming is inherently different from windows application development, and the Page lifecycle is one of the primary building blocks while learning ASP.NET. The sequence of events, especially while working with &lt;strong&gt;MasterPages&lt;/strong&gt; in ASP.NET 2.0, has become slightly more complex and this article is aims to shed some light on these events by explaining the order and importance of each event. 
&lt;h2&gt;Background&lt;/h2&gt;
&lt;p&gt;&lt;br&gt;Whenever the user requests a particular &lt;code&gt;.aspx&lt;/code&gt; page in an application, a lot of interesting things happen on the web server where the application is hosted. Understanding this sequence of events will help us to program and respond to events properly and also clear any confusion which generally arises due to the stateless nature of web programming. 
&lt;h2&gt;Basics: The New Compilation Model and the Partial Classes&lt;/h2&gt;
&lt;p&gt;Each web form in an ASP.NET application derives directly or indirectly from a &lt;code&gt;System.Web.UI.Page&lt;/code&gt; class. A web form has two components: a code behind file (&lt;code&gt;WebForm.aspx.cs&lt;/code&gt;) which contains the code for the events and other methods related to a Page, and the designer &lt;code&gt;ASPX&lt;/code&gt; file, which contains HTML control declarations and events (in the Visual Studio 2005 Web Application project model, we have a designer class named &lt;code&gt;WebForm.aspx.designer.cs&lt;/code&gt;). 
&lt;p&gt;In ASP.NET 2.0, we do not need to define the control variables as well as there event handlers in the code behind, thanks to &lt;code&gt;Partial classes&lt;/code&gt;. In ASP.NET 1.x, all this code was auto generated and placed in the code behind file under &lt;code&gt;InitializeComponent()&lt;/code&gt; section. But in version 2.0, the runtime will create a partial class dynamically from the &lt;code&gt;ASPX&lt;/code&gt; page containing all this info and merge it with the code behind partial class. This will help in making the actual code behind class a lot cleaner and more manageable. 
&lt;p&gt;Also, this would eliminate the name change related issues which were common in VS 2003 (if we change any control's ID, it had to be changed everywhere and VS used to modify the code many times). All control related events are defined in the &lt;code&gt;ASPX&lt;/code&gt; markup code. So having a single place for controls names and event handlers is cleaner and flexible, whereas the previous VS 2003 model was more &amp;quot;brittle&amp;quot;. 
&lt;h2&gt;&lt;br&gt;Real Thing: The Page life cycle&lt;/h2&gt;
&lt;p&gt;It is very important to know that for each request, the Page class is instantiated everytime from “scratch”. Which means that any values or whatever state it had previously will get lost unless we use one of the various state maintainance mechanisms provided by ASP.NET like Application, Session, Cache variables or Cookies. 
&lt;p&gt;Side Note: View state in ASP.NET 2.0 has changed and now comprises of two parts: Control State and View state. Refer this article for details: 
&lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/1whwt1k7(VS.80).aspx"&gt;&lt;u&gt;&lt;font color="#0000ff"&gt;http://msdn2.microsoft.com/en-us/library/1whwt1k7(VS.80).aspx&lt;/font&gt;&lt;/u&gt;&lt;/a&gt; 
&lt;p&gt;Below is the sequence of events which fire up sequentially with explanation on the relative importance with respect to web programming in code behind: 
&lt;p&gt;&lt;strong&gt;Important Note:&lt;/strong&gt; &lt;em&gt;All events except the Init() and Unload() are fired from outermost to the innermost control.&lt;/em&gt; &lt;em&gt;For e.g., a user control’s init event would fire before the Page_Init() event of its parent Page class.&lt;/em&gt; 
&lt;h3&gt;&lt;em&gt;&lt;/em&gt;&lt;br&gt;1. PreInit()&lt;/h3&gt;
&lt;p&gt;In this Page level event, all controls created during design time are initialized with their default values. For e.g., if you have a TextBox control with Text property = “Hello”, it would be set by now. We can create dynamic controls here. 
&lt;p&gt;This event occurs only for the Page class and UserControls/MasterPages do not have this method to override. &lt;br&gt;&lt;br&gt;Sample code where you can override this method and add your custom code:&lt;pre&gt;&lt;p&gt;
&lt;span&gt;protected&lt;/span&gt; override &lt;span&gt;void&lt;/span&gt; OnPreInit(EventArgs e)
        
{
            &lt;span&gt;//custom code            &lt;/span&gt;
           base.OnPreInit(e);
 }&lt;/pre&gt;
&lt;p&gt;Note that &lt;code&gt;PreInit()&lt;/code&gt; is the only event where we can set themes programmatically. 
&lt;p&gt;&lt;strong&gt;Special Case with MasterPages&lt;/strong&gt; 
&lt;p&gt;It is important to note that Master Page is treated like a control in the Content Pages.&lt;br&gt;So if a Page has a  Master Page associated with it, then the controls on the page will not be initialized and would be null in this stage. Only after the &lt;code&gt;Init()&lt;/code&gt; event starts, you can access these controls directly from the page class. Why? 
&lt;p&gt;The reason being that all controls placed in the Content Page are within a &lt;code&gt;ContentPlaceholder&lt;/code&gt; which is a child control of a MasterPage. Now Master Page is merged and treated like a control in the Content Pages. As I mentioned earlier, all events except the &lt;code&gt;Init()&lt;/code&gt; and &lt;code&gt;Unload()&lt;/code&gt; are fired from outermost to the innermost control. So &lt;code&gt;PreInit()&lt;/code&gt; in the Page is the first event to fire but User Controls or MasterPage (which is itself a Usercontrol) do not have any &lt;code&gt;PreInit&lt;/code&gt; event . Therefore in the &lt;code&gt;Page_PreInit()&lt;/code&gt; method, neither the MasterPage nor any user control has been initialized and only the controls inside the Page class are set to their default values. Only after the &lt;code&gt;Page_PreInit()&lt;/code&gt; event the &lt;code&gt;Init()&lt;/code&gt; events of other controls fire up. 
&lt;p&gt;See the diagram below showing control hierarchy after the &lt;code&gt;Page_Init() &lt;/code&gt;event: 
&lt;p&gt;&lt;img src="http://www.codeproject.com/useritems/lifecycle/MP.jpg"&gt; 
&lt;h3&gt;&lt;br&gt;2. OnInit()&lt;/h3&gt;
&lt;p&gt;In this event, we can read the controls properties (set at design time). We cannot read control values changed by the user because that changed value will get loaded after &lt;code&gt;LoadPostData()&lt;/code&gt; event fires. But we can access control values from the forms POST data as:&lt;pre&gt;&lt;p&gt;
string selectedValue = Request.Form[controlID].ToString();&lt;/pre&gt;
&lt;h3&gt;3. LoadViewState&lt;/h3&gt;
&lt;p&gt;&lt;br&gt;This will only fire if the Page has posted back (&lt;code&gt;IsPostBack == &lt;span&gt;true&lt;/span&gt;&lt;/code&gt;). Here the runtime de-serializes the view state data from the hidden form element and loads all controls who have view state enabled. 
&lt;h3&gt;4. LoadPostBackData&lt;/h3&gt;
&lt;p&gt;Again, this method will only fire if the Page has posted back.&lt;br&gt;In this event the controls which implement &lt;code&gt;IPostBackDataHandler&lt;/code&gt; interface gets loaded by the values from the HTTP POST data. Note that a textbox control does not gets its value from the view state but from the post data in the form in this event. So even if you disable view state for a particular control, it can get its value from the HTTP POST data if it implements &lt;code&gt;IPostBackDataHandler&lt;/code&gt; interface. 
&lt;p&gt;Also, an important point to note is that if we have a DropDownList control and we have dynamically added some items to it, the runtime cannot load those values unless the view state is enabled (even if the control derives from &lt;code&gt;IPostBackDataHandler&lt;/code&gt;). The reason being that HTTP Post data has only one value per control, and the entire value collection is not maintained in the PostData but in view state. 
&lt;h3&gt;5. Page_Load&lt;/h3&gt;
&lt;p&gt;This is the most popular method and the first one for all beginner developers to put their code. Beginners may also think that this is the first method which fires for a Page class. This can lead to a lot of confusion which makes understanding the Page lifecycle all the more important. 
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If the page has any user control, then it's Load method will fire after the Page class's Load method. The reason as explained earlier is the fact that all method except the &lt;code&gt;Init()&lt;/code&gt; are fired from the outermost control to the innermost. So after &lt;code&gt;Page_Load()&lt;/code&gt;, load methods of all other controls are fired recursively. 
&lt;h3&gt;&lt;br&gt;6. Control Event Handlers&lt;/h3&gt;
&lt;p&gt;These are basically event handlers (like Button1_Click()) which are defined for controls in the ASPX markup. Another source of confusion arises when the developer thinks that an event handler like &lt;code&gt;Button_Click()&lt;/code&gt; should fire independently (like in windows apps) as soon as he clicks a Button on the web form, forgetting that &lt;code&gt;Page_Load&lt;/code&gt; will fire first before any event handlers. 
&lt;h3&gt;7. PreRender&lt;/h3&gt;
&lt;p&gt;This event is again recursively fired for each child controls in the Page. If we want to make any changes to control values, this is the last event we have 
&lt;p&gt;to peform the same. 
&lt;h3&gt;8. SaveViewState&lt;/h3&gt;
&lt;p&gt;&lt;br&gt;Here, the ViewState of the controls gets saved in the form's hidden control. 
&lt;h3&gt;9. Render&lt;/h3&gt;
&lt;p&gt;In this method all controls are rendered recursively (i.e. Render method of each control is called). 
&lt;h3&gt;&lt;br&gt;10. Unload&lt;/h3&gt;
&lt;p&gt;Here you can have the page and controls perform clean-up operations. This event has no relevance besides clean up operations because the &lt;code&gt;Page&lt;/code&gt; has already rendered. 
&lt;h2&gt;&lt;br&gt;Dynamic Controls&lt;/h2&gt;
&lt;p&gt;Now we have seen the important events in the Page lifecycle, let's focus on how to create and maintain state of dynamically generated controls. Many times we need to generate controls dynamically for specific business use cases. For example, I was managing a famous hotel reservation website project and one of my team members was facing an issue in handling the Reservation screen. There was a &lt;code&gt;TextBox&lt;/code&gt; where the user enters the number of&lt;br&gt;rooms, and based on that value, dynamic usercontrols having a room's detailed info were created at runtime. 
&lt;p&gt;The developer complained that although he was able to generate user controls as runtime in a for loop, but was unable to save their state. When I looked into the code, I noticed that the code to generate controls was written in a Button's Click event handler. Now as we dicussed above, event handlers like &lt;code&gt;Button_Click()&lt;/code&gt; fire much later than &lt;code&gt;LoadViewState()&lt;/code&gt; and &lt;code&gt;LoadPostData()&lt;/code&gt;, where the control values get loaded from the view state and form's Post data. 
&lt;p&gt;So unless he recreates the controls in the Page_Init() or Pre_Init() methods (which occur before &lt;code&gt;LoadViewState&lt;/code&gt; and &lt;code&gt;LoadPostData&lt;/code&gt;), the control values modified by the user won't get reloaded next time. 
&lt;p&gt;Now, when he put the code in the &lt;code&gt;Page_Init()&lt;/code&gt; event, he was unable to get the number of rooms entered by the user in the &lt;code&gt;TextBox&lt;/code&gt; (which was a static control). The reason being that in &lt;code&gt;Page_Init()&lt;/code&gt;, control values are initilized to their design time default values, and do not reflect the user entered values unless they are loaded from the POST data or the view state, a process which occurs later. 
&lt;p&gt;So the only way to access the user entered value in the control is to get the value from the form's POST data. Here is the code: &lt;pre&gt;&lt;p&gt;
&lt;span&gt;protected&lt;/span&gt; override &lt;span&gt;void&lt;/span&gt; OnInit(EventArgs e)
    
{
          &lt;span&gt;//get value of the TextBox from HTTP POST data&lt;/span&gt;
        &lt;p&gt; string selectedValue ; 
         &lt;span&gt;if&lt;/span&gt;(Request.Form[&lt;span&gt;&amp;quot;txtNoOfRooms&amp;quot;&lt;/span&gt;] != null)&lt;p&gt;               selectedValue = Request.Form[&lt;span&gt;&amp;quot;txtNoOfRooms&amp;quot;&lt;/span&gt;].ToString();
           

          &lt;span&gt;//code to create controls dynamically...&lt;/span&gt;
     ...............
&lt;p&gt;          
base.OnInit(e);
    }
&lt;/pre&gt;
&lt;p&gt;  
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Thanks to &lt;a href="http://forums.asp.net/members/mbanavige.aspx"&gt;&lt;u&gt;&lt;font color="#0000ff"&gt;Mike Banavige &lt;/font&gt;&lt;/u&gt;&lt;/a&gt;of &lt;a href="http://forums.asp.net/"&gt;&lt;u&gt;&lt;font color="#0000ff"&gt;ASP.NET forums&lt;/font&gt;&lt;/u&gt;&lt;/a&gt;, I added this section. If you create a dynamic control in the Page_Load event, and add it to a &lt;code&gt;PlaceHolder&lt;/code&gt; or &lt;code&gt;Panel&lt;/code&gt; (with view state turned on), then this dynamic control will maintain its state even though it was not created in the &lt;code&gt;Page_Init()&lt;/code&gt;. Why? 
&lt;p&gt;The reason is the fact that once a control is added to the control tree of the page, &lt;code&gt;TrackViewState()&lt;/code&gt; method is responsible for tracking the state. This method gets fired automatically whenever the control is added to the control tree. Due to this reason, any modifications to the control (like adding items etc) should be done *only after* the dynamic control has been added to the control tree of the &lt;code&gt;Page&lt;/code&gt; class, else the state would be lost. See the code below:&lt;pre&gt;&lt;span&gt;protected&lt;/span&gt; &lt;span&gt;void&lt;/span&gt; Page_Load(object sender, EventArgs e)
{
  &lt;span&gt;//create a dynamic dropdown&lt;/span&gt;

DropDownList d = &lt;span&gt;new&lt;/span&gt; DropDownList();

PlaceHolder1.Controls.Add(d); &lt;span&gt;// TrackViewState() gets fired for our dropdown, so state is maintained&lt;/span&gt;

&lt;span&gt;if&lt;/span&gt; (!IsPostBack)

{

d.Items.Add(&lt;span&gt;&amp;quot;test1&amp;quot;&lt;/span&gt;);
d.Items.Add(&lt;span&gt;&amp;quot;test2&amp;quot;&lt;/span&gt;);

}

}&lt;/pre&gt;This will not work:&lt;pre&gt;&lt;font color="#0000ff" size=2&gt;&lt;p&gt;&lt;span&gt;protected&lt;/span&gt;&lt;/font&gt;&lt;font color="#000000" size=2&gt; &lt;/font&gt;&lt;font color="#0000ff" size=2&gt;&lt;span&gt;void&lt;/span&gt;&lt;/font&gt;&lt;font color="#000000" size=2&gt; Page_Load(&lt;/font&gt;&lt;font color="#0000ff" size=2&gt;object&lt;/font&gt;&lt;font color="#000000" size=2&gt; sender, &lt;/font&gt;&lt;font color="#008080" size=2&gt;EventArgs&lt;/font&gt;&lt;font size=2&gt;&lt;font color="#000000"&gt; e)&lt;/font&gt;&lt;p&gt;{&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size=2&gt;&lt;span&gt;//create a dynamic dropdown&lt;/span&gt;&lt;/font&gt;&lt;font size=2&gt;&lt;p&gt;&lt;/font&gt;&lt;font color="#008080" size=2&gt;DropDownList&lt;/font&gt;&lt;font size=2&gt; d = &lt;/font&gt;&lt;font color="#0000ff" size=2&gt;new&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color="#008080" size=2&gt;DropDownList&lt;/font&gt;&lt;font size=2&gt;();&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size=2&gt;if&lt;/font&gt;&lt;font size=2&gt; (!IsPostBack)&lt;p&gt;{&lt;p&gt;d.Items.Add(&lt;/font&gt;&lt;font color="#800000" size=2&gt;&amp;quot;test1&amp;quot;&lt;/font&gt;&lt;font size=2&gt;);&lt;p&gt;d.Items.Add(&lt;/font&gt;&lt;font color="#800000" size=2&gt;&amp;quot;test2&amp;quot;&lt;/font&gt;&lt;font size=2&gt;);&lt;p&gt;}&lt;p&gt;PlaceHolder1.Controls.Add(d); &lt;/font&gt;&lt;font color="#008000" size=2&gt;//&amp;quot;test1&amp;quot; and &amp;quot;test2&amp;quot; values are lost&lt;/font&gt;&lt;font size=2&gt;&lt;p&gt;}&lt;/font&gt;&lt;/pre&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-5487770763778616419&amp;page=RSS%3a+ASP.NET2.0+Page+lifecycle(MasterPages)&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=aspnet.spaces.live.com&amp;amp;GT1=aspnet"&gt;</description><comments>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!363.entry#comment</comments><guid isPermaLink="true">http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!363.entry</guid><pubDate>Wed, 14 Feb 2007 12:10:31 GMT</pubDate><slash:comments>2</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://aspnet.spaces.live.com/blog/cns!B3D78590D833939D!363/comments/feed.rss</wfw:commentRss><wfw:comment>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!363.entry#comment</wfw:comment><dcterms:modified>2007-02-14T12:16:57Z</dcterms:modified></item><item><title>As a beginner</title><link>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!359.entry</link><description>&lt;div&gt;guys:&lt;/div&gt;
&lt;div&gt;This post wrote for beginner.&lt;/div&gt;
&lt;div&gt;1.As a beginner,if u like to simulate from the others or samples project,i think u should  go on.Its a nice action for beginner.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;2.As a beginner,I think u should be do more practices.Everyday or a period,I sugguest u to assume a  new theme and develop it as soon as possible.&lt;/div&gt;
&lt;div&gt;But this theme should be suitable for yourself and be prone to implement.&lt;/div&gt;
&lt;div&gt;ps:keep going at everyday&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;3.As a beginner,maybe u be good at coding or deisgn,but u must be know waht is the most important for a company.u should be master the spirit of team.&lt;/div&gt;
&lt;div&gt;Maybe u are working at a small company,hmmmm.Dont worry about that,who can say this is forever for u? &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;4.As a beginner,if u can get a chance into big company,u should grasp it.dont worry about treatment,become u can learn more new ways ,technology ,management and so on.&lt;/div&gt;
&lt;div&gt;ps:more requests and more money come from pile.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;5.As a beginner,U should be use sample way to solve problem.such as write cleanly codes is important than magnify methods.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;6.As a beginner,dont use pattern&amp;amp;design in anywhere and anytime.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;                                                                                                     YunYang&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-5487770763778616419&amp;page=RSS%3a+As+a+beginner&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=aspnet.spaces.live.com&amp;amp;GT1=aspnet"&gt;</description><comments>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!359.entry#comment</comments><guid isPermaLink="true">http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!359.entry</guid><pubDate>Mon, 12 Feb 2007 15:51:18 GMT</pubDate><slash:comments>1</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://aspnet.spaces.live.com/blog/cns!B3D78590D833939D!359/comments/feed.rss</wfw:commentRss><wfw:comment>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!359.entry#comment</wfw:comment><dcterms:modified>2007-02-12T15:51:18Z</dcterms:modified></item><item><title>Bill Gates说工作方式</title><link>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!355.entry</link><description>&lt;div&gt;最近看Bill Gates探究工作方式.其中提到关于技术研发人员Desktop部分.提到在Coding时拥有两台LCD的员工工作效率要提高5%,拥有3LCD的提高9%.可谓是立竿见影的办法,但很多中小公司由于财力,认识度等等原因不能做到.&lt;/div&gt;
&lt;div&gt;由于显示面积增加了一倍，我们可以方便的穿梭于不同的窗口，完成不同的工作，而不会再像从前那样总被不同的窗口遮挡住。&lt;/div&gt;
&lt;div&gt;我个人倒觉得如果我是管理层一定会立即推行.因为这些的效率提高是非常明显的,一次投资终生收益.&lt;/div&gt;
&lt;div&gt;&lt;img src="http://i.cnn.net/money/2006/03/30/news/newsmakers/gates_howiwork_fortune/bill_gates_400.jpg"&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-5487770763778616419&amp;page=RSS%3a+Bill+Gates%e8%af%b4%e5%b7%a5%e4%bd%9c%e6%96%b9%e5%bc%8f&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=aspnet.spaces.live.com&amp;amp;GT1=aspnet"&gt;</description><comments>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!355.entry#comment</comments><guid isPermaLink="true">http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!355.entry</guid><pubDate>Sat, 10 Feb 2007 09:29:25 GMT</pubDate><slash:comments>2</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://aspnet.spaces.live.com/blog/cns!B3D78590D833939D!355/comments/feed.rss</wfw:commentRss><wfw:comment>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!355.entry#comment</wfw:comment><dcterms:modified>2007-02-13T00:25:29Z</dcterms:modified></item><item><title>弱依赖智能家庭之设备篇一</title><link>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!348.entry</link><description>&lt;div&gt;弱依赖智能家庭之设备篇一&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;密码智能门锁固名思义，只要按下用户原来设好的密码，就可以打开房门，操作简单安全.&lt;/div&gt;
&lt;div&gt;型号：M1313&lt;/div&gt;
&lt;div&gt;主要功能： &lt;br&gt;  01、通道功能:可用密码将门锁设置为通道状态&lt;br&gt;02、密码最多可以为9位数字---密码为0-9数字任意组合&lt;br&gt;03、欠压提示：自动提示用户更换电池&lt;br&gt;04、应急开锁：可利用机械钥匙进行开锁&lt;br&gt;05、密码保险：连续按错密码3次，报警1分钟，在该段时间内各键自动停止功能 &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;太阳能发电机组:&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;太阳能发电机系统实际的负载是150瓦，用一个电视机和两个灯可以点4-5小时。    机器尺寸22*14.5*43 cm   10公斤  太阳能 板和机器分开的       板的尺寸是 80*54*3cm，板的瓦数是50瓦。&lt;/div&gt;
&lt;div&gt;100W&lt;br&gt; 1. 太阳能电池板 100W, 2. 300W 控制逆变器一台 3. 需自配 12V/100AH 蓄电池一个&lt;br&gt; 日照一天可储电 29A , 可供 100W 电器使用 5 小时&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;太阳能发电机组按照电视机功率110W看,4小时没问题&lt;/div&gt; 
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;...等续&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;table cellspacing="0" border="0"&gt;&lt;tr height="8"&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;p&gt;&lt;a href="http://byfiles.storage.live.com&amp;#47;y1puFxqbOmqivxCJwTrEpZmYPM6_3cEtnWD2SVA6qg5yFPuiZev0Vt4Ug"&gt;&lt;img src="http://storage.live.com&amp;#47;items&amp;#47;B3D78590D833939D&amp;#33;353&amp;#58;thumbnail" border="0"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/td&gt;&lt;td width="15"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-5487770763778616419&amp;page=RSS%3a+%e5%bc%b1%e4%be%9d%e8%b5%96%e6%99%ba%e8%83%bd%e5%ae%b6%e5%ba%ad%e4%b9%8b%e8%ae%be%e5%a4%87%e7%af%87%e4%b8%80&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=aspnet.spaces.live.com&amp;amp;GT1=aspnet"&gt;</description><comments>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!348.entry#comment</comments><guid isPermaLink="true">http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!348.entry</guid><pubDate>Thu, 08 Feb 2007 03:00:04 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://aspnet.spaces.live.com/blog/cns!B3D78590D833939D!348/comments/feed.rss</wfw:commentRss><wfw:comment>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!348.entry#comment</wfw:comment><dcterms:modified>2007-02-08T03:20:54Z</dcterms:modified></item><item><title>Webpart 数据库的迁移</title><link>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!337.entry</link><description>&lt;div&gt;和和...到埃塞俄比亚去支援非洲兄弟的老童依然在战火纷飞的时间不忘开发,果然让我敬佩,特此POST他的血肉贴...老童要坚强...哈哈哈&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Webpart是asp.net 2.0中一项非常出色的功能，但是非常遗憾的是，默认是使用sql express 2005作为后台数据库。而且很多初学者在本机写完程序迁移到服务器上以后才如梦初醒，原来还要后台数据库的，甚至WROX出的《Professional ASP.NET 2.0》在讲webpart这节时都不曾提及后台数据库的事，真是让人失望之极（起码我没看到）。而目前主流的网站都是用MS SQLServer 2000或是Access作为数据库，如何才能把Webpart的数据库从SQL Express 2005迁移到SQLServer 2000和Access呢？ &lt;/div&gt;
&lt;div&gt;迁移到SQLServer 2000 &lt;/div&gt;
&lt;div&gt;       微软提供了一个数据库配置程序，可以方便的在SQLServer2000和SQLServer2005上进行webpart的数据库配置 。&lt;/div&gt;
&lt;div&gt;       1.首先运行SQLServer&lt;/div&gt;
&lt;div&gt;       2.然后运行C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe 会出现一个图形化的操作界面，根据提示便可自动生成一个名为aspnetdb的库。&lt;/div&gt;
&lt;div&gt;       3.打开vs.net 2005，新建一个网站，往页面上拖一个webpartmanager,运行一下,出错。因为你还没有配web.config呀，而且vs.net2005与vs.net2003有所不同，默认是没有web.config文件的,需要我们自己增加，(当然你也可以直接修改C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG下默认的web.config，但是我不推荐)。&lt;/div&gt;
&lt;div&gt;       4.在新加的web.config中把  &amp;lt;connectionStrings/&amp;gt;一行修改成如下&lt;/div&gt;
&lt;div&gt;  &amp;lt;connectionStrings&amp;gt;&lt;/div&gt;
&lt;div&gt;    &amp;lt;remove name=&amp;quot;LocalSqlServer&amp;quot; /&amp;gt;&lt;/div&gt;
&lt;div&gt;    &amp;lt;add name=&amp;quot;LocalSqlServer&amp;quot; connectionString=&amp;quot;Data Source=localhost;Initial Catalog=aspnetdb;Persist Security Info=True;User ID=sa;Password=&amp;quot;&lt;/div&gt;
&lt;div&gt;        providerName=&amp;quot;System.Data.SqlClient&amp;quot; /&amp;gt;&lt;/div&gt;
&lt;div&gt;  &amp;lt;/connectionStrings&amp;gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;完成后的web.config为&lt;/div&gt;
&lt;div&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;/div&gt;
&lt;div&gt;&amp;lt;!-- &lt;/div&gt;
&lt;div&gt;    注意: 除了手动编辑此文件以外，您还可以使用 &lt;/div&gt;
&lt;div&gt;    Web 管理工具来配置应用程序的设置。可以使用 Visual Studio 中的&lt;/div&gt;
&lt;div&gt;     “网站”-&amp;gt;“Asp.Net 配置”选项。&lt;/div&gt;
&lt;div&gt;    设置和注释的完整列表在 &lt;/div&gt;
&lt;div&gt;    machine.config.comments 中，该文件通常位于 &lt;/div&gt;
&lt;div&gt;    \Windows\Microsoft.Net\Framework\v2.x\Config 中&lt;/div&gt;
&lt;div&gt;--&amp;gt;&lt;/div&gt;
&lt;div&gt;&amp;lt;configuration&amp;gt;&lt;/div&gt;
&lt;div&gt;    &amp;lt;appSettings/&amp;gt;&lt;/div&gt;
&lt;div&gt;    &amp;lt;connectionStrings/&amp;gt;&lt;/div&gt;
&lt;div&gt;    &amp;lt;system.web&amp;gt;&lt;/div&gt;
&lt;div&gt;        &amp;lt;!-- &lt;/div&gt;
&lt;div&gt;            设置 compilation debug=&amp;quot;true&amp;quot; 将调试符号插入&lt;/div&gt;
&lt;div&gt;            已编译的页面中。但由于这会 &lt;/div&gt;
&lt;div&gt;            影响性能，因此只在开发过程中将此值 &lt;/div&gt;
&lt;div&gt;            设置为 true。&lt;/div&gt;
&lt;div&gt;        --&amp;gt;&lt;/div&gt;
&lt;div&gt;        &amp;lt;compilation debug=&amp;quot;false&amp;quot; /&amp;gt;&lt;/div&gt;
&lt;div&gt;        &amp;lt;!--&lt;/div&gt;
&lt;div&gt;            通过 &amp;lt;authentication&amp;gt; 节可以配置 ASP.NET 使用的 &lt;/div&gt;
&lt;div&gt;            安全身份验证模式，&lt;/div&gt;
&lt;div&gt;            以标识传入的用户。 &lt;/div&gt;
&lt;div&gt;        --&amp;gt;&lt;/div&gt;
&lt;div&gt;        &amp;lt;authentication mode=&amp;quot;Windows&amp;quot; /&amp;gt;&lt;/div&gt;
&lt;div&gt;        &amp;lt;!--&lt;/div&gt;
&lt;div&gt;            如果在执行请求的过程中出现未处理的错误，&lt;/div&gt;
&lt;div&gt;            则通过 &amp;lt;customErrors&amp;gt; 节可以配置相应的处理步骤。具体说来，&lt;/div&gt;
&lt;div&gt;            开发人员通过该节可以配置&lt;/div&gt;
&lt;div&gt;            要显示的 html 错误页&lt;/div&gt;
&lt;div&gt;            以代替错误堆栈跟踪。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;        &amp;lt;customErrors mode=&amp;quot;RemoteOnly&amp;quot; defaultRedirect=&amp;quot;GenericErrorPage.htm&amp;quot;&amp;gt;&lt;/div&gt;
&lt;div&gt;            &amp;lt;error statusCode=&amp;quot;403&amp;quot; redirect=&amp;quot;NoAccess.htm&amp;quot; /&amp;gt;&lt;/div&gt;
&lt;div&gt;            &amp;lt;error statusCode=&amp;quot;404&amp;quot; redirect=&amp;quot;FileNotFound.htm&amp;quot; /&amp;gt;&lt;/div&gt;
&lt;div&gt;        &amp;lt;/customErrors&amp;gt;&lt;/div&gt;
&lt;div&gt;        --&amp;gt;&lt;/div&gt;
&lt;div&gt;    &amp;lt;/system.web&amp;gt;&lt;/div&gt;
&lt;div&gt;&amp;lt;/configuration&amp;gt; &lt;/div&gt;
&lt;div&gt;迁移到Access&lt;/div&gt;
&lt;div&gt;   将webpart的数据库迁移到sqlserver是一件非常方便的事，但是对于很多小型网站来说,access才是最佳选择。但是要将数据库迁移到Access却是一件非常的复杂的事情, 而且网上也没有查到这方面现成的中文资料,之前在微软英文asp.net新闻组发了个贴子也没人回答，有些英文资料也是语焉不详,不成系统。&lt;/div&gt;
&lt;div&gt;  下面我来说一下详细的过程。&lt;/div&gt;
&lt;div&gt;   首先你需要一个access的Provider以及相对应的数据库。之前我曾经从网上找了一个access的provider，并尝试把SQLServer版的表导出成Access，结果发现这条路是行不通的,因为不匹配。&lt;/div&gt;
&lt;div&gt;       目前在英文google里能找到两个access的Provide&lt;/div&gt;
&lt;div&gt;       一个是AccessPersonalizationProvider，下载地址是&lt;/div&gt;
&lt;div&gt;&lt;a href="http://www.kowitz.net/files/AccessPersonalizationProvider.zip"&gt;http://www.kowitz.net/files/AccessPersonalizationProvider.zip&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;命名空间为MarkItUp.SingleUserBlog.Web.WebParts.AccessProviders  虽然在源代码注释里也写着copyright是微软的,但是下载时没有对应的数据库。&lt;/div&gt;
&lt;div&gt;       另外一个是微软官方网站上的以前Beta1时出的 SampleAccessProviders,解压后自带一个access数据库，而且还有web.config的样例。下载地址是&lt;/div&gt;
&lt;div&gt;&lt;a href="http://msdn.microsoft.com/vstudio/eula.aspx?id=96713a8e-b8d4-4d6e-bb8f-027e6c8e15d8"&gt;http://msdn.microsoft.com/vstudio/eula.aspx?id=96713a8e-b8d4-4d6e-bb8f-027e6c8e15d8&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;我用的是后者。&lt;/div&gt;
&lt;div&gt;下载后，名字是SampleAccessProviders.vsi，解压缩后可以在C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Templates\ProjectTemplates\Visual Web Developer\Starter Kits\ASP.NET Access Providers  找到。&lt;/div&gt;
&lt;div&gt;你可以用vs.net2005打开Access.csproj编译出dll,名字为SampleAccessProviders.dll，然后把ASPNetDB.mdb复制到App_Data目录，然后在自己的网站中引用SampleAccessProviders.dll，并参考那个web.config修改自己的配置文件。 &lt;/div&gt;
&lt;div&gt;关于其他数据库&lt;/div&gt;
&lt;div&gt;由于SampleAccessProviders是开放源代码的，所以参照着自己扩展Provider。目前网上可以找到XmlFilePersonalizationProvider。对于Oracle,mysql等数据库可以自己写扩展Provider，但是目前我们已有了access这种数据库独立的方式，所以可以通过混用来实现更为方便。 &lt;br&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-5487770763778616419&amp;page=RSS%3a+Webpart+%e6%95%b0%e6%8d%ae%e5%ba%93%e7%9a%84%e8%bf%81%e7%a7%bb&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=aspnet.spaces.live.com&amp;amp;GT1=aspnet"&gt;</description><comments>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!337.entry#comment</comments><guid isPermaLink="true">http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!337.entry</guid><pubDate>Tue, 26 Dec 2006 09:34:33 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://aspnet.spaces.live.com/blog/cns!B3D78590D833939D!337/comments/feed.rss</wfw:commentRss><wfw:comment>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!337.entry#comment</wfw:comment><dcterms:modified>2006-12-26T09:34:33Z</dcterms:modified></item><item><title>Microsoft SmartPhone 蓝牙修补程序</title><link>http://aspnet.spaces.live.com/Blog/cns!B3D78590D833939D!336.entry</link><description>&lt;div&gt;Microsoft SmartPhone的WM2003和WM5都有蓝牙耳机无法切换听音乐的毛病，归根结底是由于耳机接听进程导致蓝牙耳机不断进入工作状态造成的．&lt;/div&gt;
&lt;div&gt;解决办法是把cdial.exe进程从WM2003和WM5中关闭．&lt;/div&gt;
&lt;div&gt;下面是利用ＶＢ.NET来关闭SmartPhone的接听进程cdial.exe的代码，该代码的编译版本可以直接运行于SmartPhone的WM2003和WM5．&lt;/div&gt;
&lt;div&gt;测试环境：多普达５７５＋ＭＯＴＯ　ＨＳ８０１&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Public Class frmBlueTunes&lt;br&gt;    Inherits System.Windows.Forms.Form&lt;br&gt;    Friend WithEvents mnuOptions As System.Windows.Forms.MenuItem&lt;br&gt;    Friend WithEvents mnuEndProcess As System.Windows.Forms.MenuItem&lt;br&gt;    Friend WithEvents MenuItem4 As System.Windows.Forms.MenuItem&lt;br&gt;    Friend WithEvents mnuQuit As System.Windows.Forms.MenuItem&lt;br&gt;    Friend WithEvents mnuMain As System.Windows.Forms.MainMenu&lt;/div&gt;
&lt;div&gt;    Private cdialProcess As Process&lt;/div&gt;
&lt;div&gt;&lt;br&gt;    'Form overrides dispose to clean up the component list.&lt;br&gt;    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)&lt;br&gt;        MyBase.Dispose(disposing)&lt;br&gt;    End Sub&lt;/div&gt;
&lt;div&gt;    'NOTE: The following procedure is required by the Windows Form Designer&lt;br&gt;    'It can be modified using the Windows Form Designer.  &lt;br&gt;    'Do not modify it using the code editor.&lt;br&gt;    Friend WithEvents lblCdial As System.Windows.Forms.Label&lt;br&gt;    Friend WithEvents lblStatus As System.Windows.Forms.Label&lt;br&gt;    Friend WithEvents mnuToggle As System.Windows.Forms.MenuItem&lt;/div&gt;
&lt;div&gt;    Private Sub mnuToggle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuToggle.Click&lt;br&gt;        If cdialProcess Is Nothing Then&lt;br&gt;            Execute.ShellExecute(&amp;quot;\windows\cdial.exe&amp;quot;)&lt;br&gt;        Else&lt;br&gt;            cdialProcess.Kill()&lt;br&gt;        End If&lt;/div&gt;
&lt;div&gt;        RefreshStatus()&lt;br&gt;    End Sub&lt;/div&gt;
&lt;div&gt;    Private Sub RefreshStatus()&lt;br&gt;        cdialProcess = Process.GetCdial&lt;/div&gt;
&lt;div&gt;        If cdialProcess Is Nothing Then&lt;br&gt;            Me.lblStatus.ForeColor = System.Drawing.Color.ForestGreen&lt;br&gt;            Me.lblStatus.Text = &amp;quot;enabled&amp;quot;&lt;br&gt;            Me.mnuToggle.Text = &amp;quot;Disable&amp;quot;&lt;br&gt;        Else&lt;br&gt;            Me.lblStatus.ForeColor = System.Drawing.Color.Red&lt;br&gt;            Me.lblStatus.Text = &amp;quot;disabled&amp;quot;&lt;br&gt;            Me.mnuToggle.Text = &amp;quot;Enable&amp;quot;&lt;br&gt;        End If&lt;br&gt;    End Sub&lt;/div&gt;
&lt;div&gt;    Private Sub mnuRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuEndProcess.Click&lt;br&gt;        RefreshStatus()&lt;br&gt;    End Sub&lt;br&gt;End Class&lt;/div&gt;
&lt;div&gt;Public Class PROCESSENTRY32&lt;br&gt;    ' constants for structure definition&lt;br&gt;    Private Const SizeOffset As Integer = 0&lt;br&gt;    Private Const UsageOffset As Integer = 4&lt;br&gt;    Private Const ProcessIDOffset As Integer = 8&lt;br&gt;    Private Const DefaultHeapIDOffset As Integer = 12&lt;br&gt;    Private Const ModuleIDOffset As Integer = 16&lt;br&gt;    Private Const ThreadsOffset As Integer = 20&lt;br&gt;    Private Const ParentProcessIDOffset As Integer = 24&lt;br&gt;    Private Const PriClassBaseOffset As Integer = 28&lt;br&gt;    Private Const dwFlagsOffset As Integer = 32&lt;br&gt;    Private Const ExeFileOffset As Integer = 36&lt;br&gt;    Private Const MemoryBaseOffset As Integer = 556&lt;br&gt;    Private Const AccessKeyOffset As Integer = 560&lt;br&gt;    Private Const Size As Integer = 564 ' the whole size of the structure&lt;br&gt;    Private Const MAX_PATH As Integer = 260&lt;/div&gt;
&lt;div&gt;    ' data members&lt;br&gt;    Public dwSize As Long&lt;br&gt;    Public cntUsage As Long&lt;br&gt;    Public th32ProcessID As Long&lt;br&gt;    Public th32DefaultHeapID As Long&lt;br&gt;    Public th32ModuleID As Long&lt;br&gt;    Public cntThreads As Long&lt;br&gt;    Public th32ParentProcessID As Long&lt;br&gt;    Public pcPriClassBase As Long&lt;br&gt;    Public dwFlags As Long&lt;br&gt;    Public szExeFile As String&lt;br&gt;    Public th32MemoryBase As Long&lt;br&gt;    Public th32AccessKey As Long&lt;/div&gt;
&lt;div&gt;    ' utility:  get a uint from the byte array&lt;br&gt;    Private Shared Function GetUInt(ByRef aData() As Byte, ByVal Offset As Integer) As UInt32&lt;br&gt;        Return BitConverter.ToUInt32(aData, Offset)&lt;br&gt;    End Function&lt;/div&gt;
&lt;div&gt;    Private Shared Function GetLong(ByRef aData() As Byte, ByVal Offset As Integer) As Long&lt;br&gt;        Return BitConverter.ToInt32(aData, Offset)&lt;br&gt;    End Function&lt;/div&gt;
&lt;div&gt;    ' utility:  set a uint into the byte array&lt;br&gt;    Private Shared Sub SetUInt(ByRef aData() As Byte, ByVal Offset As Integer, ByVal Value As Integer)&lt;br&gt;        Dim buint() As Byte = BitConverter.GetBytes(Value)&lt;br&gt;        Buffer.BlockCopy(buint, 0, aData, Offset, buint.Length)&lt;br&gt;    End Sub&lt;/div&gt;
&lt;div&gt;    ' utility:  get a ushort from the byte array&lt;br&gt;    Private Shared Function GetUShort(ByRef aData() As Byte, ByVal Offset As Integer) As UInt16&lt;br&gt;        Return BitConverter.ToUInt16(aData, Offset)&lt;br&gt;    End Function&lt;/div&gt;
&lt;div&gt;    ' utility:  set a ushort int the byte array&lt;br&gt;    Private Shared Sub SetUShort(ByRef aData() As Byte, ByVal Offset As Integer, ByVal Value As Integer)&lt;br&gt;        Dim bushort() As Byte = BitConverter.GetBytes(System.Convert.ToInt16(Value))&lt;br&gt;        Buffer.BlockCopy(bushort, 0, aData, Offset, bushort.Length)&lt;br&gt;    End Sub&lt;/div&gt;
&lt;div&gt;    ' utility:  get a unicode string from the byte array&lt;br&gt;    Private Shared Function GetString(ByRef aData() As Byte, ByVal Offset As Integer, ByVal Length As Integer) As String&lt;br&gt;        Dim sReturn As String = System.Text.Encoding.Unicode.GetString(aData, Offset, Length)&lt;br&gt;        Return sReturn&lt;br&gt;    End Function&lt;/div&gt;
&lt;div&gt;    ' utility:  set a unicode string in the byte array&lt;br&gt;    Private Shared Sub SetString(ByRef aData() As Byte, ByVal Offset As Integer, ByVal Value As String)&lt;br&gt;        Dim arr() As Byte = System.Text.Encoding.ASCII.GetBytes(Value)&lt;br&gt;        Buffer.BlockCopy(arr, 0, aData, Offset, arr.Length)&lt;br&gt;    End Sub&lt;/div&gt;
&lt;div&gt;    ' create a PROCESSENTRY instance based on a byte array      &lt;br&gt;    Public Sub New(ByRef aData() As Byte)&lt;br&gt;        Me.dwSize = GetLong(aData, SizeOffset)&lt;br&gt;        Me.cntUsage = GetLong(aData, UsageOffset)&lt;br&gt;        Me.th32ProcessID = GetLong(aData, ProcessIDOffset)&lt;br&gt;        Me.th32DefaultHeapID = GetLong(aData, DefaultHeapIDOffset)&lt;br&gt;        Me.th32ModuleID = GetLong(aData, ModuleIDOffset)&lt;br&gt;        Me.cntThreads = GetLong(aData, ThreadsOffset)&lt;br&gt;        Me.th32ParentProcessID = GetLong(aData, ParentProcessIDOffset)&lt;br&gt;        Me.pcPriClassBase = GetLong(aData, PriClassBaseOffset)&lt;br&gt;        Me.dwFlags = GetLong(aData, dwFlagsOffset)&lt;br&gt;        Me.szExeFile = GetString(aData, ExeFileOffset, MAX_PATH)&lt;br&gt;        Me.th32MemoryBase = GetLong(aData, MemoryBaseOffset)&lt;br&gt;        Me.th32AccessKey = GetLong(aData, AccessKeyOffset)&lt;br&gt;    End Sub&lt;/div&gt;
&lt;div&gt;    Public Sub New()&lt;br&gt;    End Sub&lt;/div&gt;
&lt;div&gt;    ' create an initialized data array&lt;br&gt;    Public Function ToByteArray() As Byte()&lt;br&gt;        Dim aData(Size) As Byte&lt;br&gt;        ' set the Size member&lt;br&gt;        SetUInt(aData, SizeOffset, Size)&lt;br&gt;        Return aData&lt;br&gt;    End Function&lt;/div&gt;
&lt;div&gt;    Public Function Name() As String&lt;br&gt;        Return szExeFile.Substring(0, szExeFile.IndexOf(&amp;quot;\0&amp;quot;))&lt;br&gt;    End Function&lt;/div&gt;
&lt;div&gt;    Public Function PID() As Long&lt;br&gt;        Return System.Convert.ToInt64(th32ProcessID)&lt;br&gt;    End Function&lt;/div&gt;
&lt;div&gt;    Public Function BaseAddress() As Long&lt;br&gt;        Return th32MemoryBase&lt;br&gt;    End Function&lt;/div&gt;
&lt;div&gt;    Public Function ThreadCount() As Long&lt;br&gt;        Return System.Convert.ToInt64(cntThreads)&lt;br&gt;    End Function&lt;/div&gt;
&lt;div&gt;    Public Const TH32CS_SNAPPROCESS As Integer = 2&lt;/div&gt;
&lt;div&gt;    Overloads Declare Function CreateToolhelp32Snapshot Lib &amp;quot;toolhelp.dll&amp;quot; (ByVal flags As Integer, ByVal processid As Integer) As IntPtr&lt;br&gt;    Overloads Declare Function CloseToolhelp32Snapshot Lib &amp;quot;toolhelp.dll&amp;quot; (ByVal handle As IntPtr) As Integer&lt;br&gt;    Overloads Declare Function Process32First Lib &amp;quot;toolhelp.dll&amp;quot; (ByVal handle As IntPtr, ByVal pe() As Byte) As Integer&lt;br&gt;    Overloads Declare Function Process32Next Lib &amp;quot;toolhelp.dll&amp;quot; (ByVal handle As IntPtr, ByVal pe() As Byte) As Integer&lt;/div&gt;
&lt;div&gt;    Overloads Declare Function OpenProcess Lib &amp;quot;coredll.dll&amp;quot; (ByVal flags As Integer, ByVal fInherit As Boolean, ByVal PID As Integer) As IntPtr&lt;/div&gt;
&lt;div&gt;    Public Const PROCESS_TERMINATE As Integer = 1&lt;br&gt;    Overloads Declare Function TerminateProcess Lib &amp;quot;coredll.dll&amp;quot; (ByVal hProcess As IntPtr, ByVal ExitCode As UInt32) As Boolean&lt;/div&gt;
&lt;div&gt;    Overloads Declare Function CloseHandle Lib &amp;quot;coredll.dll&amp;quot; (ByVal handle As IntPtr) As Boolean&lt;br&gt;    Private Const INVALID_HANDLE_VALUE As Integer = -1&lt;br&gt;End Class&lt;/div&gt;
&lt;div&gt;Public Class Process&lt;br&gt;    Private processName As String&lt;br&gt;    Private handle As Long&lt;br&gt;    Private threadCount As Integer&lt;br&gt;    Private baseAddress As Long&lt;/div&gt;
&lt;div&gt;    'default constructor&lt;br&gt;    Public Sub New()&lt;br&gt;    End Sub&lt;/div&gt;
&lt;div&gt;    'private helper constructor&lt;br&gt;    Private Sub New(ByVal id As Long, ByVal procname As String, ByVal threadcount As Integer, ByVal baseaddress As Long)&lt;br&gt;        Me.handle = id&lt;br&gt;        Me.processName = procname&lt;br&gt;        Me.threadCount = threadcount&lt;br&gt;        Me.baseAddress = baseaddress&lt;br&gt;    End Sub&lt;/div&gt;
&lt;div&gt;    Public Shared Function GetCdial() As Process&lt;/div&gt;
&lt;div&gt;        Dim cdialProc As Process&lt;/div&gt;
&lt;div&gt;        'temp ArrayList&lt;br&gt;        Dim handle As IntPtr = PROCESSENTRY32.CreateToolhelp32Snapshot(PROCESSENTRY32.TH32CS_SNAPPROCESS, 0)&lt;/div&gt;
&lt;div&gt;        If handle.ToInt32 &amp;gt; 0 Then&lt;br&gt;            Try&lt;br&gt;                Dim peCurrent As PROCESSENTRY32&lt;br&gt;                Dim pe32 As PROCESSENTRY32 = New PROCESSENTRY32&lt;br&gt;                'Get byte array to pass to the API calls&lt;br&gt;                Dim peBytes() As Byte = pe32.ToByteArray()&lt;br&gt;                'Get the first process&lt;br&gt;                Dim retval As Integer = PROCESSENTRY32.Process32First(handle, peBytes)&lt;br&gt;                While retval = 1 And cdialProc Is Nothing&lt;br&gt;                    'Convert bytes to the class&lt;br&gt;                    peCurrent = New PROCESSENTRY32(peBytes)&lt;/div&gt;
&lt;div&gt;                    If peCurrent.Name.Substring(0, 9).Equals(&amp;quot;cdial.exe&amp;quot;) Then&lt;br&gt;                        cdialProc = New Process(peCurrent.PID, peCurrent.Name, peCurrent.ThreadCount, peCurrent.BaseAddress)&lt;br&gt;                    End If&lt;/div&gt;
&lt;div&gt;                    retval = PROCESSENTRY32.Process32Next(handle, peBytes)&lt;br&gt;                End While&lt;br&gt;            Catch ex As Exception&lt;br&gt;                Throw New Exception(&amp;quot;Exception: &amp;quot; + ex.Message)&lt;br&gt;            End Try&lt;/div&gt;
&lt;div&gt;            'Close handle&lt;br&gt;            PROCESSENTRY32.CloseToolhelp32Snapshot(handle)&lt;/div&gt;
&lt;div&gt;            Return cdialProc&lt;br&gt;        Else&lt;br&gt;            Throw New Exception(&amp;quot;Unable to create snapshot&amp;quot;)&lt;br&gt;        End If&lt;br&gt;    End Function&lt;/div&gt;
&lt;div&gt