<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
>

<channel>
	<title>My way of my life &#187; asp.net</title>
	<atom:link href="http://www.kync.com/blog/tag/aspnet/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kync.com/blog</link>
	<description>Those ashame days.</description>
	<lastBuildDate>Mon, 12 Apr 2010 21:51:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/us/</creativeCommons:license>
		<item>
		<title>About Random Code &#8211; 随机验证码</title>
		<link>http://www.kync.com/blog/2006/04/about-random-code/</link>
		<comments>http://www.kync.com/blog/2006/04/about-random-code/#comments</comments>
		<pubDate>Mon, 17 Apr 2006 12:45:35 +0000</pubDate>
		<dc:creator>Sunyc</dc:creator>
				<category><![CDATA[asp.net]]></category>
		<category><![CDATA[Web Dev]]></category>

		<guid isPermaLink="false">http://www.kync.com/blog/essays/about-random-code/</guid>
		<description><![CDATA[这是今天突然间顿悟的，留下来当个纪念。作了好多网站，也改过好多网站，对于防止程序提交问题上，总是习惯性的找一段生成随机验证码的程序把它最后的结果放在session里面，然后再session里面验证一下是否正确就算万事大吉。今天想想不禁汗颜。
对于这种code，要攻击太容易了。没有验证码就把东西都写到url上用get方式过去刷屏,像上面这样做的就先访问一次页面在session里留下验证码，下次就一直用同一个code就能刷屏了。更绝的，如果你感觉到会出问题，在验证逻辑里把session中的值清空了。那下次随便谁成功提交一次之后就可以用url大法刷你的版了。。
解决办法就是
验证之后，在session变量里面放一个随机值。
]]></description>
			<content:encoded><![CDATA[<p>这是今天突然间顿悟的，留下来当个纪念。<br />作了好多网站，也改过好多网站，对于防止程序提交问题上，总是习惯性的找一段生成随机验证码的程序把它最后的结果放在session里面，然后再session里面验证一下是否正确就算万事大吉。今天想想不禁汗颜。</p>
<p>对于这种code，要攻击太容易了。没有验证码就把东西都写到url上用get方式过去刷屏,像上面这样做的就先访问一次页面在session里留下验证码，下次就一直用同一个code就能刷屏了。更绝的，如果你感觉到会出问题，在验证逻辑里把session中的值清空了。那下次随便谁成功提交一次之后就可以用url大法刷你的版了。。</p>
<p>解决办法就是</p>
<h2>验证之后，在session变量里面放一个随机值。</h2>
]]></content:encoded>
			<wfw:commentRss>http://www.kync.com/blog/2006/04/about-random-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/us/</creativeCommons:license>
	</item>
		<item>
		<title>Asp.net 2.0 中 Global.asax &lt;object&gt; 初始化问题</title>
		<link>http://www.kync.com/blog/2006/04/aspnet-global-asax-object-tag/</link>
		<comments>http://www.kync.com/blog/2006/04/aspnet-global-asax-object-tag/#comments</comments>
		<pubDate>Wed, 12 Apr 2006 22:47:59 +0000</pubDate>
		<dc:creator>Sunyc</dc:creator>
				<category><![CDATA[asp.net]]></category>

		<guid isPermaLink="false">http://www.kync.com/blog/kb/aspnet/aspnet-global-asax-object-tag/</guid>
		<description><![CDATA[Global.asax中声明了一个 &#60;object id=&#34;xxx&#34; class=&#34;xxx&#34;&#62; 之后按MS的说法，应该自动被初始化到ApplicationState中，可惜事实不是这样。如果你没有进行预编译，那么他工作的很好，确实出现在Application.StaticObjects里面了，如果你象我一样最后进行预编译发布，就会发现它的值一直是null,Application_Start后根本没有初始化。
晚上为了这个事情查了一夜，最后得出的结论是，微软决定抛弃这种做法了，改为使用static 变量实现这类要求。不过我觉得这样还不如老老实实用Application[&#34;object&#34;]形式呢! 
总结来说，如果你想维护一个应用程序级别的变量，放在Application中，维护Session级别的，放在Session中。 
最后再歧视一下微软，象某人说的，莫非.net 微软也在玩 XP ?
]]></description>
			<content:encoded><![CDATA[<p>Global.asax中声明了一个 &lt;object id=&quot;xxx&quot; class=&quot;xxx&quot;&gt; 之后按MS的说法，应该自动被初始化到ApplicationState中，可惜事实不是这样。如果你没有进行预编译，那么他工作的很好，确实出现在Application.StaticObjects里面了，如果你象我一样最后进行预编译发布，就会发现它的值一直是null,Application_Start后根本没有初始化。</p>
<p>晚上为了这个事情查了一夜，最后得出的结论是，微软决定抛弃这种做法了，改为使用static 变量实现这类要求。不过我觉得这样还不如老老实实用Application[&quot;object&quot;]形式呢! </p>
<p>总结来说，如果你想维护一个应用程序级别的变量，放在Application中，维护Session级别的，放在Session中。 </p>
<p>最后再歧视一下微软，象某人说的，莫非.net 微软也在玩 XP ?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kync.com/blog/2006/04/aspnet-global-asax-object-tag/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/us/</creativeCommons:license>
	</item>
		<item>
		<title>用aspnet_compiler发布网站</title>
		<link>http://www.kync.com/blog/2006/04/aspnet-website-prebuild-and-release/</link>
		<comments>http://www.kync.com/blog/2006/04/aspnet-website-prebuild-and-release/#comments</comments>
		<pubDate>Wed, 12 Apr 2006 17:55:07 +0000</pubDate>
		<dc:creator>Sunyc</dc:creator>
				<category><![CDATA[asp.net]]></category>

		<guid isPermaLink="false">http://www.kync.com/blog/essays/asp-net-prebuild-and-release/</guid>
		<description><![CDATA[Here is the most important concept to come to terms with in 2.0: Visual Studio 2005 knows nothing about compiling a web application. In 1.1 VS built the code-behind and ASP.NET built the web forms. In 2.0 Visual Studio 2005 delegates all compilation responsibilities to the ASP.NET platform.  from 
Debug and Release Builds in [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>Here is the most important concept to come to terms with in 2.0: Visual Studio 2005 knows nothing about compiling a web application. In 1.1 VS built the code-behind and ASP.NET built the web forms. In 2.0 Visual Studio 2005 delegates all compilation responsibilities to the ASP.NET platform. <br/> from <a href="http://odetocode.com/Blogs/scott/archive/2005/11/15/2464.aspx"><br />
<em>Debug and Release Builds in ASP.NET 2.0</em><br />
</a>
</p></blockquote>
<p>在asp.net 2.0模型中，vs2005已经完全脱离了编译而成为了一个彻底的ide.算是一个不小的改动。其中更是取消了有关Web Application的概念，使得习惯了vs2003的人刚开始的时候会有一些摸不着头脑。下面简单说一下我在使用过程中自己总结的，算是一点经验。<br/><br />
新建web工程并且位置是文件系统的时候，vs2005只是帮你建好了一个sln文件，这个东西只是指引msbuild 如何进行编译的，过程是：ide 调用 msbuild ,msbuild解析sln文件,msbuild调用aspnet_compiler.exe进行网站的编译。所以aspnet_compiler.exe只是负责进行网站的编译的。<br/><br />
预编译的概念在 .netframework 1.1 里面就存在了，vs2003中的预编译指的是将页面对应的cs/vb文件与resx文件编译后统一集成到一个dll中放到bin目录下，将aspx文件直接拷贝过去。这样做会留下隐患，因为aspx文件就直接暴露在最后的发行包中，如果完全是codeb-behind模型还好，只能改改界面，如果采用了页面上的<%%>来生成页面，源代码就暴露了。针对这些问题，vs2005采用了一种新的模式。<br />
请参看<a href="http://msdn2.microsoft.com/zh-cn/library/ms229863(VS.80).aspx">ASP.NET 编译工具 (Aspnet_compiler.exe) </a>这篇文章了解对各种文件的处理方式。<br />
IDE发布：<br />
vs2005中选择 生成-〉发布网站，在对话框中的操作将映射到aspnet_compiler.exe的参数中，可更新的发布对应 -u，其他选项类似，请参考上面的文章了解。<br />
注意：发布时将忽略web.config中的debug参数，统一生成无调试信息的文件。<br />
手工编译：<br />
简单说来，如果是无更新发布模式编译，appcode下面的class编译成dll放在bin下,页面内容清空位置不变作占位用，同时页面被编译成一个随机名称的dll,增加一个同名.compiled文件到bin目录下，内容大概如下：</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;</li>
<li>&lt;preserve resultType=&quot;3&quot; virtualPath=&quot;/Forum/AdminList.aspx&quot; hash=&quot;6772609c3&quot; filehash=&quot;49154463f1d6738c&quot; flags=&quot;110000&quot; assembly=&quot;App_Web_hmrycg3w&quot; type=&quot;ASP.forum_adminlist_aspx&quot;&gt;</li>
<li>&nbsp;&nbsp; &nbsp;&lt;filedeps&gt;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;filedep name=&quot;/Controls/footer.ascx&quot; /&gt;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;filedep name=&quot;/Controls/header.ascx&quot; /&gt;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;filedep name=&quot;/Forum/AdminList.aspx&quot; /&gt;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;filedep name=&quot;/Forum/AdminList.aspx.cs&quot; /&gt;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;filedep name=&quot;/Forum/menu.ascx&quot; /&gt;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;filedep name=&quot;/Forum/menu.ascx.cs&quot; /&gt;</li>
<li>&nbsp;&nbsp; &nbsp;&lt;/filedeps&gt;</li>
<li>&lt;/preserve&gt;</li></ol></div>
<p>里面只是列出了页面上的customcontrol,这里已经完成了和masterfile的映射。这样最大限度的保护了页面的敏感信息，发布过的网站中只能看见一堆文件名了。可更新的发布模式与vs2003类似，页面就直接拷贝过来不予编译了。<br/><br />
讲了一堆原理，下面说一下aspnet_compiler.exe的调用方法,这是我使用的例子</p>
<blockquote><p>
我的开发目录是这样的</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">Project/</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;library/</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;devroot/</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pubroot/</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;proj.sln</li></ol></div>
<p>使用的命令如下：</br><br />
aspnet_compiler -v / -p .\devroot -f .\pubroot</p></blockquote>
<p>分析：</p>
<ul>
<li>-v / 指明了iis的虚拟目录</li>
<li>-p .\devroot 表示代码实际位置</li>
<li>.\pubroot 指明了要发布的位置</li>
<li>-f 表示强制改写目标位置</li>
</ul>
<p>你还可以用-u来进行传统意义上的预编译，-d来插入编译符号。<br/><br />
总的来说，aspnet_compile结合msbuild,提供了一个很好的自动化编译环境，值得研究研究：）</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kync.com/blog/2006/04/aspnet-website-prebuild-and-release/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/us/</creativeCommons:license>
	</item>
	</channel>
</rss>
