<?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/"
	>

<channel>
	<title>枫芸志 &#187; 程序开发</title>
	<atom:link href="http://witmax.cn/category/programming/feed" rel="self" type="application/rss+xml" />
	<link>http://witmax.cn</link>
	<description>记录成长路途上的点滴总结</description>
	<lastBuildDate>Sat, 12 May 2012 04:45:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>PHP6取消了get_magic_quotes_gpc函数</title>
		<link>http://witmax.cn/php6-cancel-magic-quotes.html</link>
		<comments>http://witmax.cn/php6-cancel-magic-quotes.html#comments</comments>
		<pubDate>Mon, 26 Mar 2012 11:19:28 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[程序开发]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=2017</guid>
		<description><![CDATA[把服务器的PHP版本升到6以后，发现系统彻底空白，猜到是PHP程序运行时出问题了，逐步调试了一下，原来get_magic_quotes_gpc函数的问题，也就是下面这段代码的地方： 查了一下原来PHP6取消了magic quotes机制，那么就默认转义一下一些特殊字符来防止SQL注入吧，代码改为如下： 系统运行正常了。 &#160; 在Discuz里遇到了很多类似如下的代码： 那就改成这样吧 P.S. mysql_real_escaple_string函数在php6下也遇到了问题，会导致httpd.exe出错，但从文档来看并没有找到依据，姑且用addslashes替代来解决了；有知道原因的同学烦请告知下。 参考：現在寫 PHP6-compatible 的一些技巧<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜您喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fphp-filter-partial-utf8-char.html&from=http%3A%2F%2Fwitmax.cn%2Fphp6-cancel-magic-quotes.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【PHP】过滤不完整的UTF-8字符的函数</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fphp-cannot-redeclare-class.html&from=http%3A%2F%2Fwitmax.cn%2Fphp6-cancel-magic-quotes.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【PHP】Fatal error: Cannot redeclare class的解决办法</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fphp-datetime-function.html&from=http%3A%2F%2Fwitmax.cn%2Fphp6-cancel-magic-quotes.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【PHP】常用日期时间函数</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fphp-is_numeric-vs-ctype_digit.html&from=http%3A%2F%2Fwitmax.cn%2Fphp6-cancel-magic-quotes.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【PHP】检测数字字符串is_numeric与ctype_digit的区别</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>把服务器的PHP版本升到6以后，发现系统彻底空白，猜到是PHP程序运行时出问题了，逐步调试了一下，原来get_magic_quotes_gpc函数的问题，也就是下面这段代码的地方：</p>
<pre class="brush: php; title: ; notranslate">if (!get_magic_quotes_gpc())   {
$_REQUEST = array_map( 'addslashes',   $_REQUEST);
} </pre>
<p><span id="more-2017"></span></p>
<p>查了一下原来PHP6取消了magic quotes机制，那么就默认转义一下一些特殊字符来防止SQL注入吧，代码改为如下：</p>
<pre class="brush: php; title: ; notranslate">if(PHP_VERSION &gt;= 6 || !get_magic_quotes_gpc()) {
$_REQUEST = array_map( 'addslashes', $_REQUEST);
} </pre>
<p>系统运行正常了。</p>
<p>&nbsp;</p>
<p>在Discuz里遇到了很多类似如下的代码：</p>
<pre class="brush: php; title: ; notranslate">define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());</pre>
<p>那就改成这样吧</p>
<pre class="brush: php; title: ; notranslate">define('MAGIC_QUOTES_GPC', PHP_VERSION &lt; 6 &amp;&amp; get_magic_quotes_gpc());</pre>
<p>P.S. mysql_real_escaple_string函数在php6下也遇到了问题，会导致httpd.exe出错，但从文档来看并没有找到依据，姑且用addslashes替代来解决了；有知道原因的同学烦请告知下。</p>
<p>参考：<a href="http://blog.gslin.org/archives/2007/09/25/1318/" target="_blank">現在寫 PHP6-compatible 的一些技巧</a></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜您喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fphp-filter-partial-utf8-char.html&from=http%3A%2F%2Fwitmax.cn%2Fphp6-cancel-magic-quotes.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【PHP】过滤不完整的UTF-8字符的函数</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fphp-cannot-redeclare-class.html&from=http%3A%2F%2Fwitmax.cn%2Fphp6-cancel-magic-quotes.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【PHP】Fatal error: Cannot redeclare class的解决办法</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fphp-datetime-function.html&from=http%3A%2F%2Fwitmax.cn%2Fphp6-cancel-magic-quotes.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【PHP】常用日期时间函数</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fphp-is_numeric-vs-ctype_digit.html&from=http%3A%2F%2Fwitmax.cn%2Fphp6-cancel-magic-quotes.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【PHP】检测数字字符串is_numeric与ctype_digit的区别</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/php6-cancel-magic-quotes.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>【PHP】session过期时间设置</title>
		<link>http://witmax.cn/php-session-expiration.html</link>
		<comments>http://witmax.cn/php-session-expiration.html#comments</comments>
		<pubDate>Mon, 19 Mar 2012 11:29:43 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[程序开发]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=2006</guid>
		<description><![CDATA[1. session在server端（一般是Apache with PHP module）如何存在的？ 默认的，php会将session保存在/tmp目录下，文件名为这个样子：sess_01aab840166fd1dc253e3b4a3f0b8381。每一个文件对应了一个session（会话）。 删除这里的session文件，就表示对应的session失效了。 2. session在client端（一般是浏览器）如何存在的？ session在浏览器端，只需要保存session ID（由server端生成的唯一ID）就可以了。有两种保存方式：在cookie中、在url里面。如果cookie中保存session ID，就可以看到浏览器的cookie中有一个PHPSESID变量。如果是URL传递的，就可以看到形如: index.php?PHPSESID=01aab840166fd1dc253e3b4a3f0b8381的URL。（在server端通过session.use_cookies来控制使用哪一种方式） 3. 在server端，php如何判断session文件是否过期？ 如果”最后的修改时间”到”现在”超过了gc_maxlifetime（默认是1440）秒，这个session文件就被认为是过期了，在下一次session回收的时候，如果这个文件仍然没有被更改过，这个session文件就会被删除（session就过期了）。 简单的说，如果我登录到某网站，如果在1440秒（默认值）内没有操作过，那么对应的session就认为是过期了。 所以，修改php.ini文件中的gc_maxlifetime变量就可以延长session的过期时间了：（例如，我们把过期时间修改为86400秒） 然后，重启你的web服务（一般是apache）就可以了。 注意：php5里面session过期使用了回收机制。这里设置时间为86400秒，如果session在86400秒内没有被修改过，那么在下一次“回收”时才真的被删除。 4. session“回收”何时发生？ 默认情况下，每一次php请求，就会有1/100的概率发生回收，所以可能简单的理解为“每100次php请求就有一次回收发生”。这个概率是通过以下参数控制的 注意1：假设这种情况gc_maxlifetime=120，如果某个session文件最后修改时间是120秒之前，那么在下一次回收（1/100的概率）发生前，这个session仍然是有效的。 注意2：如果你的session使用session.save_path中使用别的地方保存session，session回收机制有可能不会自动处理过期session文件。这时需要定时手动（或者crontab）的删除过期的session：cd /path/to/sessions; find -cmin +24 &#124; xargs rm 5. 一些特殊情况 因为回收机制会检查文件的“最后修改时间”，所以如果某个会话是活跃的，但是session的内容没有改变过，那么对应的session文件也就没有改变过，回收机制会认为这是一个长时间没有活跃的session而将其删除。这是我们不愿看到的，可以通过增加如下的简单代码解决这个问题： 代码会每隔60秒，尝试修改修改一次session。 总结：如果想修改session过期时间，修改变量gc_maxlifetime就可以了。php5的session采用被动的回收机制（garbage collection）。过期的session文件不会自己消失，而是通过触发“回收”来处理过期的session。 原文：http://hi.baidu.com/djiz/blog/item/1becb1ecf169f42a62d09fdf.html<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜您喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="【PHP】过滤不完整的UTF-8字符的函数" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fphp-filter-partial-utf8-char.html&from=http%3A%2F%2Fwitmax.cn%2Fphp-session-expiration.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/08/21642838.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">【PHP】过滤不完整的UTF-8字符的函数</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="【PHP】写入.csv文件注意点" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fphp-write-csv.html&from=http%3A%2F%2Fwitmax.cn%2Fphp-session-expiration.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/02/11/2667873.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">【PHP】写入.csv文件注意点</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="【PHP】setcookie设置Cookie用法（及设置无效的问题）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fphp-set-cookie.html&from=http%3A%2F%2Fwitmax.cn%2Fphp-session-expiration.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">【PHP】setcookie设置Cookie用法（及设置无效的问题）</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP6取消了get_magic_quotes_gpc函数" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fphp6-cancel-magic-quotes.html&from=http%3A%2F%2Fwitmax.cn%2Fphp-session-expiration.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP6取消了get_magic_quotes_gpc函数</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;"><strong>1. session在server端（一般是Apache with PHP module）如何存在的？</strong></span></p>
<p>默认的，php会将session保存在/tmp目录下，文件名为这个样子：sess_01aab840166fd1dc253e3b4a3f0b8381。每一个文件对应了一个session（会话）。</p>
<pre class="brush: plain; title: ; notranslate">more /tmp/sess_01aab840166fd1dc253e3b4a3f0b8381
username|s:9:”jiangfeng”;admin|s:1:”0″;
#变量名|类型:长度:值</pre>
<p>删除这里的session文件，就表示对应的session失效了。</p>
<p><span id="more-2006"></span></p>
<p><span style="color: #ff0000;"><strong>2. session在client端（一般是浏览器）如何存在的？</strong></span></p>
<p>session在浏览器端，只需要保存session ID（由server端生成的唯一ID）就可以了。有两种保存方式：在cookie中、在url里面。如果cookie中保存session ID，就可以看到浏览器的cookie中有一个PHPSESID变量。如果是URL传递的，就可以看到形如:<br />
index.php?PHPSESID=01aab840166fd1dc253e3b4a3f0b8381的URL。（在server端通过session.use_cookies来控制使用哪一种方式）</p>
<p><span style="color: #ff0000;"><strong>3. 在server端，php如何判断session文件是否过期？</strong></span></p>
<p>如果”最后的修改时间”到”现在”超过了gc_maxlifetime（默认是1440）秒，这个session文件就被认为是过期了，在下一次session回收的时候，如果这个文件仍然没有被更改过，这个session文件就会被删除（session就过期了）。</p>
<p>简单的说，如果我登录到某网站，如果在1440秒（默认值）内没有操作过，那么对应的session就认为是过期了。</p>
<p>所以，修改php.ini文件中的gc_maxlifetime变量就可以延长session的过期时间了：（例如，我们把过期时间修改为86400秒）</p>
<pre class="brush: plain; title: ; notranslate">session.gc_maxlifetime = 86400</pre>
<p>然后，重启你的web服务（一般是apache）就可以了。</p>
<p>注意：php5里面session过期使用了回收机制。这里设置时间为86400秒，如果session在86400秒内没有被修改过，那么在下一次“回收”时才真的被删除。</p>
<p><span style="color: #ff0000;"><strong>4. session“回收”何时发生？</strong></span></p>
<p>默认情况下，每一次php请求，就会有1/100的概率发生回收，所以可能简单的理解为“每100次php请求就有一次回收发生”。这个概率是通过以下参数控制的</p>
<pre class="brush: plain; title: ; notranslate">#概率是gc_probability/gc_divisor
session.gc_probability = 1
session.gc_divisor = 100</pre>
<p>注意1：假设这种情况gc_maxlifetime=120，如果某个session文件最后修改时间是120秒之前，那么在下一次回收（1/100的概率）发生前，这个session仍然是有效的。</p>
<p>注意2：如果你的session使用session.save_path中使用别的地方保存session，session回收机制有可能不会自动处理过期session文件。这时需要定时手动（或者crontab）的删除过期的session：cd /path/to/sessions; find -cmin +24 | xargs rm</p>
<p><span style="color: #ff0000;"><strong>5. 一些特殊情况</strong></span></p>
<p>因为回收机制会检查文件的“最后修改时间”，所以如果某个会话是活跃的，但是session的内容没有改变过，那么对应的session文件也就没有改变过，回收机制会认为这是一个长时间没有活跃的session而将其删除。这是我们不愿看到的，可以通过增加如下的简单代码解决这个问题：</p>
<pre class="brush: php; title: ; notranslate">&lt;?php
if(!isset($_SESSION['last_access'])||(time()-$_SESSION['last_access'])&gt;60)
        $_SESSION['last_access'] = time();
?&gt;</pre>
<p>代码会每隔60秒，尝试修改修改一次session。</p>
<p>总结：如果想修改session过期时间，修改变量gc_maxlifetime就可以了。php5的session采用被动的回收机制（garbage collection）。过期的session文件不会自己消失，而是通过触发“回收”来处理过期的session。</p>
<p>原文：http://hi.baidu.com/djiz/blog/item/1becb1ecf169f42a62d09fdf.html</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜您喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="【PHP】过滤不完整的UTF-8字符的函数" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fphp-filter-partial-utf8-char.html&from=http%3A%2F%2Fwitmax.cn%2Fphp-session-expiration.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/08/21642838.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">【PHP】过滤不完整的UTF-8字符的函数</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="【PHP】写入.csv文件注意点" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fphp-write-csv.html&from=http%3A%2F%2Fwitmax.cn%2Fphp-session-expiration.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/02/11/2667873.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">【PHP】写入.csv文件注意点</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="【PHP】setcookie设置Cookie用法（及设置无效的问题）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fphp-set-cookie.html&from=http%3A%2F%2Fwitmax.cn%2Fphp-session-expiration.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">【PHP】setcookie设置Cookie用法（及设置无效的问题）</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP6取消了get_magic_quotes_gpc函数" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fphp6-cancel-magic-quotes.html&from=http%3A%2F%2Fwitmax.cn%2Fphp-session-expiration.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP6取消了get_magic_quotes_gpc函数</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/php-session-expiration.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>【PHP】PDO中使用Like进行参数模糊查找</title>
		<link>http://witmax.cn/the-pdo-like.html</link>
		<comments>http://witmax.cn/the-pdo-like.html#comments</comments>
		<pubDate>Thu, 15 Mar 2012 07:55:53 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[程序开发]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=1999</guid>
		<description><![CDATA[使用以下PDO代码进行参数的模糊查找，结果没有返回数据 分析了一下，原因是PDO在解析生成sql语句时做了防sql注入机制，将参数替换为值时默认在值的两倍增加了单引号‘，导致了最后的结果sql并非我们想要的。 正确的做法是，将模糊查询用的%放到bindValue中来，具体代码改为如下： 以上代码测试有效。 P.S.目前碰到了一个相似的问题，利用PDO机制无法完美解决，代码如下： 上述代码解析后的SQL语句为 于是语句执行出错，目前只能用直接拼接SQL字符串的方式解决了下；各位达人看看能否给出完美的解决方案？<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜您喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="【PHP】过滤不完整的UTF-8字符的函数" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fphp-filter-partial-utf8-char.html&from=http%3A%2F%2Fwitmax.cn%2Fthe-pdo-like.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/08/21642838.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">【PHP】过滤不完整的UTF-8字符的函数</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="【PHP】强制下载文件的代码（解决了IE下中文文件名乱码问题）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fphp-force-download.html&from=http%3A%2F%2Fwitmax.cn%2Fthe-pdo-like.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">【PHP】强制下载文件的代码（解决了IE下中文文件名乱码问题）</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="【PHP】写入.csv文件注意点" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fphp-write-csv.html&from=http%3A%2F%2Fwitmax.cn%2Fthe-pdo-like.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/02/11/2667873.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">【PHP】写入.csv文件注意点</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="【PHP】session过期时间设置" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fphp-session-expiration.html&from=http%3A%2F%2Fwitmax.cn%2Fthe-pdo-like.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">【PHP】session过期时间设置</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>使用以下PDO代码进行参数的模糊查找，结果没有返回数据</p>
<pre class="brush: plain; title: ; notranslate">$db = new PDO(DB_DSN, DB_USERNAME, DB_PASSWORD, $pdo_options);
$query = $database-&gt;prepare('SELECT * FROM table WHERE  name LIKE &quot;%:name%&quot;');
$query-&gt;bindValue(':name', $name, PDO::PARAM_STR);
$query-&gt;execute();
while ($results = $query-&gt;fetch())
{
   echo $results['name'];
}</pre>
<p><span id="more-1999"></span></p>
<p>分析了一下，原因是PDO在解析生成sql语句时做了防sql注入机制，将参数替换为值时默认在值的两倍增加了单引号‘，导致了最后的结果sql并非我们想要的。</p>
<p>正确的做法是，将模糊查询用的%放到bindValue中来，具体代码改为如下：</p>
<pre class="brush: plain; title: ; notranslate">$db = new PDO(DB_DSN, DB_USERNAME, DB_PASSWORD, $pdo_options);
$query = $database-&gt;prepare('SELECT * FROM table WHERE  name LIKE :name');
$query-&gt;bindValue(':name', '%'.$name.'%', PDO::PARAM_STR);
$query-&gt;execute();
while ($results = $query-&gt;fetch())
{
   echo $results['name'];
}</pre>
<p>以上代码测试有效。</p>
<p>P.S.目前碰到了一个相似的问题，利用PDO机制无法完美解决，代码如下：</p>
<pre class="brush: plain; title: ; notranslate">$field = 'name';
$value = 'maple';
$id = 1;
$db = new PDO(DB_DSN, DB_USERNAME, DB_PASSWORD, $pdo_options);
$query = $database-&gt;prepare('UPDATE users SET :field = :value where id = :id');
$query-&gt;bindValue(':field', $field, PDO::PARAM_STR);
$query-&gt;bindValue(':value', $value, PDO::PARAM_STR);
$query-&gt;bindValue(':id', $id, PDO::PARAM_STR);
$query-&gt;execute();</pre>
<p>上述代码解析后的SQL语句为</p>
<pre class="brush: sql; title: ; notranslate">UPDATE users SET 'name' = 'maple' where id = '1'</pre>
<p>于是语句执行出错，目前只能用直接拼接SQL字符串的方式解决了下；各位达人看看能否给出完美的解决方案？</pre>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜您喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="【PHP】过滤不完整的UTF-8字符的函数" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fphp-filter-partial-utf8-char.html&from=http%3A%2F%2Fwitmax.cn%2Fthe-pdo-like.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/08/21642838.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">【PHP】过滤不完整的UTF-8字符的函数</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="【PHP】强制下载文件的代码（解决了IE下中文文件名乱码问题）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fphp-force-download.html&from=http%3A%2F%2Fwitmax.cn%2Fthe-pdo-like.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">【PHP】强制下载文件的代码（解决了IE下中文文件名乱码问题）</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="【PHP】写入.csv文件注意点" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fphp-write-csv.html&from=http%3A%2F%2Fwitmax.cn%2Fthe-pdo-like.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/02/11/2667873.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">【PHP】写入.csv文件注意点</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="【PHP】session过期时间设置" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fphp-session-expiration.html&from=http%3A%2F%2Fwitmax.cn%2Fthe-pdo-like.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">【PHP】session过期时间设置</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/the-pdo-like.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>ASP.NET在web.config中的认证配置</title>
		<link>http://witmax.cn/web-config-authentication-configuration.html</link>
		<comments>http://witmax.cn/web-config-authentication-configuration.html#comments</comments>
		<pubDate>Tue, 13 Mar 2012 03:07:54 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[程序开发]]></category>
		<category><![CDATA[DotNet]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=1975</guid>
		<description><![CDATA[ASP.NET支持在web.config中直接进行访问权限的管理，具体如下，以下是网站根目录下的web.config代码片段 意为所有未登陆过的或登录用户名不为maple和maple2的访问都会被跳转到登录页面~/Account/Login.aspx；由于CSS文件的特殊性，需要将访问权限开放给所有用户。 更多配置可参考web.config详解和asp.net的登录验证方法 Web.config 的作用范围 拒绝与巧用允许 访问权限配置<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜您喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="【.NET】&quot;若要针对 .NET Framework 4.0 或更高版本进行编译，则提供程序选项中“compilerVersion”特性的值必须为“v4.0”或更高版本。……&quot;的解决办法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fdotnet-web-config-compilerversion.html&from=http%3A%2F%2Fwitmax.cn%2Fweb-config-authentication-configuration.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">【.NET】&quot;若要针对 .NET Framework 4.0 或更高版本进行编译，则提供程序选项中“compilerVersion”特性的值必须为“v4.0”或更高版本。……&quot;的解决办法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="卸载.Net Framework Assistant火狐扩展插件" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Funinstall-dotnet-framework-assistant.html&from=http%3A%2F%2Fwitmax.cn%2Fweb-config-authentication-configuration.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/02/11/2667739.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">卸载.Net Framework Assistant火狐扩展插件</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="“未在本地计算机上注册Microsoft.Jet.OLEDB.4.0提供程序”的解决办法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fno-microsoft-jet-oledb.html&from=http%3A%2F%2Fwitmax.cn%2Fweb-config-authentication-configuration.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">“未在本地计算机上注册Microsoft.Jet.OLEDB.4.0提供程序”的解决办法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Web前端开发笔试题集锦（HTML/CSS篇）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fweb-dev-test-html.html&from=http%3A%2F%2Fwitmax.cn%2Fweb-config-authentication-configuration.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/05/08/8009943.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Web前端开发笔试题集锦（HTML/CSS篇）</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>ASP.NET支持在web.config中直接进行访问权限的管理，具体如下，以下是网站根目录下的web.config代码片段</p>
<pre class="brush: plain; title: ; notranslate">&lt;configuration&gt;

  &lt;location path=&quot;Styles/Site.css&quot;&gt;
    &lt;system.web&gt;
      &lt;authorization&gt;
        &lt;allow users=&quot;*&quot;/&gt;
      &lt;/authorization&gt;
    &lt;/system.web&gt;
  &lt;/location&gt;

  &lt;system.web&gt;
    &lt;compilation debug=&quot;true&quot; targetFramework=&quot;4.0&quot; /&gt;

    &lt;authentication mode=&quot;Forms&quot;&gt;
      &lt;forms loginUrl=&quot;~/Account/Login.aspx&quot; timeout=&quot;2880&quot; /&gt;
    &lt;/authentication&gt;
    &lt;authorization&gt;
      &lt;allow users=&quot;maple,maple2&quot;/&gt;
      &lt;deny users=&quot;*&quot;/&gt;
    &lt;/authorization&gt;

    &lt;/configuration&gt;</pre>
<p><span id="more-1975"></span></p>
<p>意为所有未登陆过的或登录用户名不为maple和maple2的访问都会被跳转到登录页面~/Account/Login.aspx；由于CSS文件的特殊性，需要将访问权限开放给所有用户。</p>
<p>更多配置可参考<a href="http://zhoufoxcn.blog.51cto.com/792419/166441" target="_blank">web.config详解</a>和<a href="http://hi.baidu.com/zhanglontao/blog/item/63a8b8dbd665dcd7b7fd484d.html" target="_blank">asp.net的登录验证方法 Web.config 的作用范围 拒绝与巧用允许 访问权限配置</a></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜您喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="【.NET】&quot;若要针对 .NET Framework 4.0 或更高版本进行编译，则提供程序选项中“compilerVersion”特性的值必须为“v4.0”或更高版本。……&quot;的解决办法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fdotnet-web-config-compilerversion.html&from=http%3A%2F%2Fwitmax.cn%2Fweb-config-authentication-configuration.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">【.NET】&quot;若要针对 .NET Framework 4.0 或更高版本进行编译，则提供程序选项中“compilerVersion”特性的值必须为“v4.0”或更高版本。……&quot;的解决办法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="卸载.Net Framework Assistant火狐扩展插件" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Funinstall-dotnet-framework-assistant.html&from=http%3A%2F%2Fwitmax.cn%2Fweb-config-authentication-configuration.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/02/11/2667739.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">卸载.Net Framework Assistant火狐扩展插件</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="“未在本地计算机上注册Microsoft.Jet.OLEDB.4.0提供程序”的解决办法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fno-microsoft-jet-oledb.html&from=http%3A%2F%2Fwitmax.cn%2Fweb-config-authentication-configuration.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">“未在本地计算机上注册Microsoft.Jet.OLEDB.4.0提供程序”的解决办法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Web前端开发笔试题集锦（HTML/CSS篇）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fweb-dev-test-html.html&from=http%3A%2F%2Fwitmax.cn%2Fweb-config-authentication-configuration.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/05/08/8009943.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Web前端开发笔试题集锦（HTML/CSS篇）</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/web-config-authentication-configuration.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>【C】字符串和链表元素的反转</title>
		<link>http://witmax.cn/c-string-and-linked-list-reversal.html</link>
		<comments>http://witmax.cn/c-string-and-linked-list-reversal.html#comments</comments>
		<pubDate>Sun, 12 Feb 2012 09:01:21 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[程序开发]]></category>
		<category><![CDATA[C]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=1967</guid>
		<description><![CDATA[比较简单的C语言笔试题，自己写了一下，记录 字符串反转 链表元素反转 P.S. 判断链表是否有环及两链表是否相交 逆序数/逆序数对<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜您喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fc-function-heap-stack.html&from=http%3A%2F%2Fwitmax.cn%2Fc-string-and-linked-list-reversal.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C语言函数堆栈的思考</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fc-the-sizeof-vs-strlen.html&from=http%3A%2F%2Fwitmax.cn%2Fc-string-and-linked-list-reversal.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【C】sizeof与strlen的比较</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fc-int-vs-size_t.html&from=http%3A%2F%2Fwitmax.cn%2Fc-string-and-linked-list-reversal.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【C】int与size_t的区别</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fc-get-structure-offset.html&from=http%3A%2F%2Fwitmax.cn%2Fc-string-and-linked-list-reversal.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【C】取出结构中成员变量偏移位置的宏定义</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>比较简单的C语言笔试题，自己写了一下，记录</p>
<p><strong>字符串反转</strong></p>
<p><span id="more-1967"></span></p>
<pre class="brush: cpp; title: ; notranslate">#include &lt;stdio.h&gt;

char *reverse(char *str)
{
     int len = strlen(str);
     int steps = len / 2;
     int i, j;
     for(i=0; i&lt; steps; i++)
     {
         j = len - 1 - i;
         str[i] = str[j] ^ str[i];
         str[j] = str[j] ^ str[i];
         str[i] = str[j] ^ str[i];
     }
     return str;
}

int main(int argc, char *argv[])
{
    char s[] = &quot;abcdef!&quot;;
    printf(&quot;%s\n&quot;, s);
    reverse(s);
    printf(&quot;%s\n&quot;, s);

    return 0;
}</pre>
<p><strong>链表元素反转</strong></p>
<pre class="brush: cpp; title: ; notranslate">#include &lt;stdio.h&gt;

typedef struct node
{
    struct node *next;
    int val;
} Node;

Node *create(int n)
{
    Node *head = NULL, *p = NULL, *cur=NULL;
    while(n--)
    {
        p = (Node*)malloc(sizeof(Node));
        p-&gt;val = n;
        p-&gt;next = NULL;
        if (head == NULL)
        {
            cur = head = p;
        }
        else
        {
            cur-&gt;next = p;
            cur = p;
        }
    }
    return head;
}

void print(Node *head)
{
    Node *p = head;
    while(p != NULL)
    {
        printf(&quot;%d &quot;, p-&gt;val);
        p = p-&gt;next;
    }
    printf(&quot;\n&quot;);
}

Node *reverse(Node *head)
{
    Node *cur, *q, *p = head;
    if (p == NULL || p-&gt;next  == NULL)
    {
        return p;
    }
    else
    {
        q = p-&gt;next;
        cur = reverse(p-&gt;next);
        q-&gt;next = p;
        p-&gt;next = NULL;
        return cur;
    }
}

int main(int argc, char *argv[])
{
    Node *head = create(10);
    print(head);
    head = reverse(head);
    print(head);
    return 0;
}</pre>
<p>P.S.</p>
<ol>
<li><a href="http://blog.csdn.net/kevinzhangyang/article/details/6637503" target="_blank">判断链表是否有环及两链表是否相交</a></li>
<li><a href="http://fuliang.iteye.com/blog/405566" target="_blank">逆序数/逆序数对</a></li>
</ol>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜您喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fc-function-heap-stack.html&from=http%3A%2F%2Fwitmax.cn%2Fc-string-and-linked-list-reversal.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">C语言函数堆栈的思考</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fc-the-sizeof-vs-strlen.html&from=http%3A%2F%2Fwitmax.cn%2Fc-string-and-linked-list-reversal.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【C】sizeof与strlen的比较</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fc-int-vs-size_t.html&from=http%3A%2F%2Fwitmax.cn%2Fc-string-and-linked-list-reversal.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【C】int与size_t的区别</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fc-get-structure-offset.html&from=http%3A%2F%2Fwitmax.cn%2Fc-string-and-linked-list-reversal.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【C】取出结构中成员变量偏移位置的宏定义</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/c-string-and-linked-list-reversal.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>【C#】MVC请求统一验证的方法</title>
		<link>http://witmax.cn/mvc-request-unified-authentication.html</link>
		<comments>http://witmax.cn/mvc-request-unified-authentication.html#comments</comments>
		<pubDate>Sun, 05 Feb 2012 02:55:25 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[程序开发]]></category>
		<category><![CDATA[CSharp]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=1947</guid>
		<description><![CDATA[MVC出色的地方是优雅的URL格式和代码结构，很实用。 使用过程中遇到一个问题是需要对MVC的请求做统一的token验证，如果验证不过则跳转到制定页面。网上方法不多，不过还是找到了解决办法，即重写控制器的OnActionExecuting方法，在动作执行前进行统一的预处理，实现代码如下： 再修改其他所有的控制器继承自BaseController就OK了。上面的代码实现了出Home控制器外的请求在token验证失败时跳转到错误提示页面。<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜您喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fcsharp-import-xls.html&from=http%3A%2F%2Fwitmax.cn%2Fmvc-request-unified-authentication.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【C#】上传并读取导入.xls文件</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fwpf-cross-thread-operation.html&from=http%3A%2F%2Fwitmax.cn%2Fmvc-request-unified-authentication.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【WPF】C#跨线程操作窗体控件</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fcsharp-class-vs-struct.html&from=http%3A%2F%2Fwitmax.cn%2Fmvc-request-unified-authentication.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【C#】class与struct的区别</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fmath-comment-spam-protection.html&from=http%3A%2F%2Fwitmax.cn%2Fmvc-request-unified-authentication.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【WordPress】留言算术验证码插件Math Comment Spam Protection</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>MVC出色的地方是优雅的URL格式和代码结构，很实用。</p>
<p>使用过程中遇到一个问题是需要对MVC的请求做统一的token验证，如果验证不过则跳转到制定页面。网上方法不多，不过还是找到了解决办法，即重写控制器的OnActionExecuting方法，在动作执行前进行统一的预处理，实现代码如下：</p>
<p><span id="more-1947"></span></p>
<p>public class BaseController : Controller<br />
{<br />
    protected override void OnActionExecuting(ActionExecutingContext context)<br />
    {<br />
        // 非错误提示接口则判断是否授权<br />
        if (!(context.ActionDescriptor.ControllerDescriptor.ControllerName == &quot;Home&quot;))<br />
        {<br />
            if (!CheckToken())<br />
            {<br />
                context.Result = RedirectToRoute(&quot;Default&quot;, new { Controller = &quot;Home&quot;, Action = &quot;Error&quot;, errCode = Error.TOKEN_ERR_CODE, errMsg = Error.TOKEN_ERR_MSG });<br />
            }<br />
        }<br />
        base.OnActionExecuting(context);<br />
    }</p>
<p>    /// &lt;summary&gt;<br />
    /// 验证token是否正确<br />
    /// &lt;/summary&gt;<br />
    /// &lt;returns&gt;&lt;/returns&gt;<br />
    private bool CheckToken()<br />
    {<br />
        if (System.Configuration.ConfigurationManager.AppSettings[&quot;check_token&quot;] == &quot;true&quot;)<br />
        {<br />
            string token = System.Configuration.ConfigurationManager.AppSettings[&quot;app_token&quot;];<br />
            return (Request[&quot;token&quot;] != null &amp;&amp; Request[&quot;token&quot;].ToString() == token);<br />
        }<br />
        else<br />
        {<br />
            return true;<br />
        }<br />
    }<br />
}<br />
再修改其他所有的控制器继承自BaseController就OK了。上面的代码实现了出Home控制器外的请求在token验证失败时跳转到错误提示页面。</pre>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜您喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fcsharp-import-xls.html&from=http%3A%2F%2Fwitmax.cn%2Fmvc-request-unified-authentication.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【C#】上传并读取导入.xls文件</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fwpf-cross-thread-operation.html&from=http%3A%2F%2Fwitmax.cn%2Fmvc-request-unified-authentication.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【WPF】C#跨线程操作窗体控件</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fcsharp-class-vs-struct.html&from=http%3A%2F%2Fwitmax.cn%2Fmvc-request-unified-authentication.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【C#】class与struct的区别</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fmath-comment-spam-protection.html&from=http%3A%2F%2Fwitmax.cn%2Fmvc-request-unified-authentication.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【WordPress】留言算术验证码插件Math Comment Spam Protection</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/mvc-request-unified-authentication.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>【.NET】”若要针对 .NET Framework 4.0 或更高版本进行编译，则提供程序选项中“compilerVersion”特性的值必须为“v4.0”或更高版本。……”的解决办法</title>
		<link>http://witmax.cn/dotnet-web-config-compilerversion.html</link>
		<comments>http://witmax.cn/dotnet-web-config-compilerversion.html#comments</comments>
		<pubDate>Wed, 01 Feb 2012 15:11:35 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[程序开发]]></category>
		<category><![CDATA[DotNet]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=1928</guid>
		<description><![CDATA[用C#基于.NET Framework 4.0开发的程序，调试一切正常，但发布后放到正式环境就出现了以下错误 若 要针对 .NET Framework 4.0 或更高版本进行编译，则提供程序选项中“compilerVersion”特性的值必须为“v4.0”或更高版本。若要针对 .NET Framework 3.5 或更低版本编译此 Web 应用程序，则请从 Web.config 文件的 &#60;compilation&#62; 元素中移除 targetFramework 特性。 解决办法： 在网站的Web.config中增加或修改configuration&#62;system.codedom配置节<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜您喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fweb-config-authentication-configuration.html&from=http%3A%2F%2Fwitmax.cn%2Fdotnet-web-config-compilerversion.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">ASP.NET在web.config中的认证配置</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fno-microsoft-jet-oledb.html&from=http%3A%2F%2Fwitmax.cn%2Fdotnet-web-config-compilerversion.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">“未在本地计算机上注册Microsoft.Jet.OLEDB.4.0提供程序”的解决办法</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Funinstall-dotnet-framework-assistant.html&from=http%3A%2F%2Fwitmax.cn%2Fdotnet-web-config-compilerversion.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">卸载.Net Framework Assistant火狐扩展插件</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Faspnet_checkschemaversion.html&from=http%3A%2F%2Fwitmax.cn%2Fdotnet-web-config-compilerversion.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【SQL】找不到存储过程 'dbo.aspnet_CheckSchemaVersion'的解决办法</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>用C#基于.NET Framework 4.0开发的程序，调试一切正常，但发布后放到正式环境就出现了以下错误</p>
<blockquote><p>若 要针对 .NET Framework 4.0 或更高版本进行编译，则提供程序选项中“compilerVersion”特性的值必须为“v4.0”或更高版本。若要针对 .NET Framework 3.5 或更低版本编译此 Web 应用程序，则请从 Web.config 文件的 &lt;compilation&gt; 元素中移除 targetFramework 特性。</p></blockquote>
<p>解决办法：</p>
<p>在网站的Web.config中增加或修改configuration&gt;system.codedom配置节</p>
<p><span id="more-1928"></span></p>
<pre class="brush: plain; title: ; notranslate">&lt;system.codedom&gt;
      &lt;compilers&gt;
         &lt;compiler language=&quot;c#;cs;csharp&quot; extension=&quot;.cs&quot; type=&quot;Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&quot; warningLevel=&quot;4&quot;&gt;
             &lt;providerOption name=&quot;CompilerVersion&quot; value=&quot;v4.0&quot;/&gt;
             &lt;providerOption name=&quot;WarnAsError&quot; value=&quot;false&quot;/&gt;
       &lt;/compiler&gt;
         &lt;compiler language=&quot;vb;vbs;visualbasic;vbscript&quot; extension=&quot;.vb&quot; type=&quot;Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&quot; warningLevel=&quot;4&quot;&gt;
          &lt;providerOption name=&quot;CompilerVersion&quot; value=&quot;v4.0&quot;/&gt;
          &lt;providerOption name=&quot;OptionInfer&quot; value=&quot;true&quot;/&gt;
          &lt;providerOption name=&quot;WarnAsError&quot; value=&quot;false&quot;/&gt;
         &lt;/compiler&gt;
      &lt;/compilers&gt;
  &lt;/system.codedom&gt;</pre>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜您喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fweb-config-authentication-configuration.html&from=http%3A%2F%2Fwitmax.cn%2Fdotnet-web-config-compilerversion.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">ASP.NET在web.config中的认证配置</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fno-microsoft-jet-oledb.html&from=http%3A%2F%2Fwitmax.cn%2Fdotnet-web-config-compilerversion.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">“未在本地计算机上注册Microsoft.Jet.OLEDB.4.0提供程序”的解决办法</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Funinstall-dotnet-framework-assistant.html&from=http%3A%2F%2Fwitmax.cn%2Fdotnet-web-config-compilerversion.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">卸载.Net Framework Assistant火狐扩展插件</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Faspnet_checkschemaversion.html&from=http%3A%2F%2Fwitmax.cn%2Fdotnet-web-config-compilerversion.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【SQL】找不到存储过程 'dbo.aspnet_CheckSchemaVersion'的解决办法</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/dotnet-web-config-compilerversion.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>【SQL】找不到存储过程 &#8216;dbo.aspnet_CheckSchemaVersion&#8217;的解决办法</title>
		<link>http://witmax.cn/aspnet_checkschemaversion.html</link>
		<comments>http://witmax.cn/aspnet_checkschemaversion.html#comments</comments>
		<pubDate>Sun, 22 Jan 2012 11:36:09 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[程序开发]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=1917</guid>
		<description><![CDATA[在C#中用Membership时遇到了这个问题，如下 找不到存储过程 &#8216;dbo.aspnet_CheckSchemaVersion&#8217; 根据提示，通过数据库管理器建立这个存储过程就OK了，这个方法这里不提。但因为数据库是新建的，所以很可能有很多相关的存储过程都没有。于是找到了一下的方法： 运行C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe ASP.NET SQL Server数据库安装向导来进行配置。 通过配置对应的数据库即可，问题解决。<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜您喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fsql-null-order.html&from=http%3A%2F%2Fwitmax.cn%2Faspnet_checkschemaversion.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【SQL】非NULL数据排序提前</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fsql-row-column-exchange.html&from=http%3A%2F%2Fwitmax.cn%2Faspnet_checkschemaversion.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【SQL】行列互换代码实例</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fsql-each-first.html&from=http%3A%2F%2Fwitmax.cn%2Faspnet_checkschemaversion.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【SQL】获取每篇文章的第一条评论</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fsql-random-read-records.html&from=http%3A%2F%2Fwitmax.cn%2Faspnet_checkschemaversion.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【SQL】随机读取N条记录（MySQL、SQL Server、Access、Oracle、postgreSQL）</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>在C#中用Membership时遇到了这个问题，如下</p>
<blockquote><p>找不到存储过程 &#8216;dbo.aspnet_CheckSchemaVersion&#8217;</p></blockquote>
<p>根据提示，通过数据库管理器建立这个存储过程就OK了，这个方法这里不提。但因为数据库是新建的，所以很可能有很多相关的存储过程都没有。于是找到了一下的方法：</p>
<p>运行C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe ASP.NET SQL Server数据库安装向导来进行配置。</p>
<p>通过配置对应的数据库即可，问题解决。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜您喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fsql-null-order.html&from=http%3A%2F%2Fwitmax.cn%2Faspnet_checkschemaversion.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【SQL】非NULL数据排序提前</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fsql-row-column-exchange.html&from=http%3A%2F%2Fwitmax.cn%2Faspnet_checkschemaversion.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【SQL】行列互换代码实例</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fsql-each-first.html&from=http%3A%2F%2Fwitmax.cn%2Faspnet_checkschemaversion.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【SQL】获取每篇文章的第一条评论</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fsql-random-read-records.html&from=http%3A%2F%2Fwitmax.cn%2Faspnet_checkschemaversion.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【SQL】随机读取N条记录（MySQL、SQL Server、Access、Oracle、postgreSQL）</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/aspnet_checkschemaversion.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>【SQL】找不到存储过程 &#8216;dbo.aspnet_Membership_GetUserByUserId&#8217; 的解决办法</title>
		<link>http://witmax.cn/aspnet_membership_getuserbyuserid.html</link>
		<comments>http://witmax.cn/aspnet_membership_getuserbyuserid.html#comments</comments>
		<pubDate>Sun, 22 Jan 2012 09:54:12 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[程序开发]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=1913</guid>
		<description><![CDATA[C#用Membership功能时报了这么个错误 找不到存储过程 &#8216;dbo.aspnet_Membership_GetUserByUserId&#8217; 根据提示，很显然数据库里缺少响应的存储过程，用数据库管理器打开对应的数据库执行以下sql语句即可。 参考：[dbo].[aspnet_Membership_GetUserByUserId]<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜您喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Faspnet_checkschemaversion.html&from=http%3A%2F%2Fwitmax.cn%2Faspnet_membership_getuserbyuserid.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【SQL】找不到存储过程 'dbo.aspnet_CheckSchemaVersion'的解决办法</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fsql-row-column-exchange.html&from=http%3A%2F%2Fwitmax.cn%2Faspnet_membership_getuserbyuserid.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【SQL】行列互换代码实例</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fsql-each-first.html&from=http%3A%2F%2Fwitmax.cn%2Faspnet_membership_getuserbyuserid.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【SQL】获取每篇文章的第一条评论</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fsql-null-order.html&from=http%3A%2F%2Fwitmax.cn%2Faspnet_membership_getuserbyuserid.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【SQL】非NULL数据排序提前</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>C#用Membership功能时报了这么个错误</p>
<blockquote><p>找不到存储过程 &#8216;dbo.aspnet_Membership_GetUserByUserId&#8217;</p></blockquote>
<p>根据提示，很显然数据库里缺少响应的存储过程，用数据库管理器打开对应的数据库执行以下sql语句即可。</p>
<p><span id="more-1913"></span></p>
<pre class="brush: sql; title: ; notranslate">SET QUOTED_IDENTIFIER OFF
GO

CREATE PROCEDURE dbo.aspnet_Membership_GetUserByUserId
    @UserId               uniqueidentifier,
    @CurrentTimeUtc       datetime,
    @UpdateLastActivity   bit = 0
AS
BEGIN
    IF ( @UpdateLastActivity = 1 )
    BEGIN
        UPDATE   dbo.aspnet_Users
        SET      LastActivityDate = @CurrentTimeUtc
        FROM     dbo.aspnet_Users
        WHERE    @UserId = UserId

        IF ( @@ROWCOUNT = 0 ) -- User ID not found
            RETURN -1
    END

    SELECT  m.Email, m.PasswordQuestion, m.Comment, m.IsApproved,
            m.CreateDate, m.LastLoginDate, u.LastActivityDate,
            m.LastPasswordChangedDate, u.UserName, m.IsLockedOut,
            m.LastLockoutDate
    FROM    dbo.aspnet_Users u, dbo.aspnet_Membership m
    WHERE   @UserId = u.UserId AND u.UserId = m.UserId

    IF ( @@ROWCOUNT = 0 ) -- User ID not found
       RETURN -1

    RETURN 0
END

GO</pre>
<p>参考：<a href="http://docs.imis.com/15.1/Schema/Programmability/Stored_Procedures/aspnet_Membership_GetUserByUserId.html" target="_blank">[dbo].[aspnet_Membership_GetUserByUserId]</a></pre>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜您喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Faspnet_checkschemaversion.html&from=http%3A%2F%2Fwitmax.cn%2Faspnet_membership_getuserbyuserid.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【SQL】找不到存储过程 'dbo.aspnet_CheckSchemaVersion'的解决办法</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fsql-row-column-exchange.html&from=http%3A%2F%2Fwitmax.cn%2Faspnet_membership_getuserbyuserid.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【SQL】行列互换代码实例</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fsql-each-first.html&from=http%3A%2F%2Fwitmax.cn%2Faspnet_membership_getuserbyuserid.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【SQL】获取每篇文章的第一条评论</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fsql-null-order.html&from=http%3A%2F%2Fwitmax.cn%2Faspnet_membership_getuserbyuserid.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【SQL】非NULL数据排序提前</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/aspnet_membership_getuserbyuserid.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>【C#】class与struct的区别</title>
		<link>http://witmax.cn/csharp-class-vs-struct.html</link>
		<comments>http://witmax.cn/csharp-class-vs-struct.html#comments</comments>
		<pubDate>Thu, 12 Jan 2012 13:51:11 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[程序开发]]></category>
		<category><![CDATA[CSharp]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=1898</guid>
		<description><![CDATA[class和struct语法几乎相同，但其本质却截然不同：class是引用类型，struct是值类型，也就是说在内存中存储方式有别，由此产生的一系列差异性。 class(类)是面向对象编程的基本概念，是一种自定义数据结构类型，通常包含字段、属性、方法、构造函数、索引器、事件等。在.NET中，所有的类都继承自System.Object类，是一种引用类型，也就是说，当我们new出一个类的实例时，对象保存了该实例实际数据的引用地址，而对象的值保存在托管堆中。 struct(结构)是一种值类型，用于将一组相关的信息变量组织成为一个单一的变量实体。所有的结构都继承自System.ValueType类，是一种值类型，我们可以像使用int和char一样去使用struct。struct实例分配在线程的堆栈上，它本身存储了值，而不是指向该值的指针。 了解了class和struct的本质，我们可以通过分析和实验来总结二者的区别： （1）关于实质：class是引用类型，struct是值类型 （2）关于职能：class是行为的封装，用来表述对象，而struct是数据的封装，用来储存数据 （3）关于继承：class支持继承自类和接口；而struct只能支继承接口。struct不能从class继承，也不能作为class的基类。 （4）关于构造函数：class可以声明无参构造函数，可以声明析构函数；而struct只能声明带参数构造函数，且不能声明析构函数。 （5）关于实例化：class要使用new关键字；而struct可以不使用new关键字，struct在声明时就进行了初始化过程，所有的成员变量均默认为0或null。 （6）关于抽象：class可以实抽象类(abstract)，可以声明抽象函数；而struct不能。 （7）关于重载：class可以声明protected成员、virtual成员、sealed成员和override成员；而struct不可以，但是值得注意的是，struct可以重载System.Object的3个虚方法，Equals()、ToString()和GetHashTable()。 （8）关于比较：两个class的比较有Equals和==两种，即值相等和引用相同；而两个struct可以直接通过==来判断。 （9）关于销毁：class实例由垃圾回收机制来保证内存的回收处理；而struct变量使用完后立即自动解除内存分配。 （10）关于参数传递：class变量是以按址方式传递；而struct变量是以按值方式传递的。 既然class几乎可以完全替代struct来实现所有的功能，那么struct还有存在的必要吗？至少在以下情况下，我们应该考虑使用struct来代替class： 实现一个用于存储数据的结构时，可以考虑struct。 考虑与某些非托管代码通信的兼容性问题时，可以考虑struct。 原文：NET中class与struct的区别简析 P.S. 附一篇《C#中虚函数和抽象函数的区别》<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜您喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fc-constant-pointer-vs-pointer-constant.html&from=http%3A%2F%2Fwitmax.cn%2Fcsharp-class-vs-struct.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【C】常量指针和指针常量的区别</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fc-int-vs-size_t.html&from=http%3A%2F%2Fwitmax.cn%2Fcsharp-class-vs-struct.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【C】int与size_t的区别</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fc-sizeof-vs-strlen.html&from=http%3A%2F%2Fwitmax.cn%2Fcsharp-class-vs-struct.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【C】sizeof与strlen的比较</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fc-md5-code.html&from=http%3A%2F%2Fwitmax.cn%2Fcsharp-class-vs-struct.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【C】md5函数实现代码</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>class和struct语法几乎相同，但其本质却截然不同：class是引用类型，struct是值类型，也就是说在内存中存储方式有别，由此产生的一系列差异性。</p>
<p>class(类)是面向对象编程的基本概念，是一种自定义数据结构类型，通常包含字段、属性、方法、构造函数、索引器、事件等。在.NET中，所有的类都继承自System.Object类，是一种引用类型，也就是说，当我们new出一个类的实例时，对象保存了该实例实际数据的引用地址，而对象的值保存在托管堆中。</p>
<p><span id="more-1898"></span></p>
<p>struct(结构)是一种值类型，用于将一组相关的信息变量组织成为一个单一的变量实体。所有的结构都继承自System.ValueType类，是一种值类型，我们可以像使用int和char一样去使用struct。struct实例分配在线程的堆栈上，它本身存储了值，而不是指向该值的指针。</p>
<p>了解了class和struct的本质，我们可以通过分析和实验来总结二者的区别：</p>
<p>（1）关于实质：class是引用类型，struct是值类型</p>
<p>（2）关于职能：class是行为的封装，用来表述对象，而struct是数据的封装，用来储存数据</p>
<p>（3）关于继承：class支持继承自类和接口；而struct只能支继承接口。struct不能从class继承，也不能作为class的基类。</p>
<p>（4）关于构造函数：class可以声明无参构造函数，可以声明析构函数；而struct只能声明带参数构造函数，且不能声明析构函数。</p>
<p>（5）关于实例化：class要使用new关键字；而struct可以不使用new关键字，struct在声明时就进行了初始化过程，所有的成员变量均默认为0或null。</p>
<p>（6）关于抽象：class可以实抽象类(abstract)，可以声明抽象函数；而struct不能。</p>
<p>（7）关于重载：class可以声明protected成员、virtual成员、sealed成员和override成员；而struct不可以，但是值得注意的是，struct可以重载System.Object的3个虚方法，Equals()、ToString()和GetHashTable()。</p>
<p>（8）关于比较：两个class的比较有Equals和==两种，即值相等和引用相同；而两个struct可以直接通过==来判断。</p>
<p>（9）关于销毁：class实例由垃圾回收机制来保证内存的回收处理；而struct变量使用完后立即自动解除内存分配。</p>
<p>（10）关于参数传递：class变量是以按址方式传递；而struct变量是以按值方式传递的。</p>
<p>既然class几乎可以完全替代struct来实现所有的功能，那么struct还有存在的必要吗？至少在以下情况下，我们应该考虑使用struct来代替class：</p>
<ol>
<li>实现一个用于存储数据的结构时，可以考虑struct。</li>
<li>考虑与某些非托管代码通信的兼容性问题时，可以考虑struct。</li>
</ol>
<p>原文：<a href="http://www.cnblogs.com/tangself/archive/2009/12/10/1621416.html" target="_blank">NET中class与struct的区别简析</a></p>
<p>P.S. 附一篇《<a href="http://hi.baidu.com/liaidongyinhu/blog/item/85fe0cc6d66acaa48326ac43.html" target="_blank">C#中虚函数和抽象函数的区别</a>》</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">猜您喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fc-constant-pointer-vs-pointer-constant.html&from=http%3A%2F%2Fwitmax.cn%2Fcsharp-class-vs-struct.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【C】常量指针和指针常量的区别</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fc-int-vs-size_t.html&from=http%3A%2F%2Fwitmax.cn%2Fcsharp-class-vs-struct.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【C】int与size_t的区别</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fc-sizeof-vs-strlen.html&from=http%3A%2F%2Fwitmax.cn%2Fcsharp-class-vs-struct.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【C】sizeof与strlen的比较</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwitmax.cn%2Fc-md5-code.html&from=http%3A%2F%2Fwitmax.cn%2Fcsharp-class-vs-struct.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【C】md5函数实现代码</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/csharp-class-vs-struct.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

