﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-Gezidan Studio (鸽子蛋博客)-随笔分类-C#</title><link>http://www.cppblog.com/gezidan/category/17471.html</link><description>每日必需来踩踩哦..</description><language>zh-cn</language><lastBuildDate>Wed, 12 Oct 2011 15:49:16 GMT</lastBuildDate><pubDate>Wed, 12 Oct 2011 15:49:16 GMT</pubDate><ttl>60</ttl><item><title>封装的用于WinForm的Html编辑器</title><link>http://www.cppblog.com/gezidan/archive/2011/10/10/157949.html</link><dc:creator>Gezidan Studio</dc:creator><author>Gezidan Studio</author><pubDate>Mon, 10 Oct 2011 04:06:00 GMT</pubDate><guid>http://www.cppblog.com/gezidan/archive/2011/10/10/157949.html</guid><wfw:comment>http://www.cppblog.com/gezidan/comments/157949.html</wfw:comment><comments>http://www.cppblog.com/gezidan/archive/2011/10/10/157949.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cppblog.com/gezidan/comments/commentRss/157949.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/gezidan/services/trackbacks/157949.html</trackback:ping><description><![CDATA[<div>一直没找到好用的用于WinForm的Html编辑器，于是自己封装了个，还没完工，先上个预览图。<br />
<div><img src="http://www.cppblog.com/images/cppblog_com/gezidan/17469/r_editor.PNG" width="659" height="534" alt="" /></div>
等完成了上代码。
</div>
<br />
﻿
<div class="MySignatureBoard" style="padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 14px; line-height: 24px; min-height: 31px; overflow-x: hidden; overflow-y: hidden; word-wrap: break-word; word-break: break-all; "> <img alt="Logo" src="http://www.cppblog.com/images/cppblog_com/gezidan/17469/r_Rixu_net(245_100).png" style="padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px;border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; margin-left: 10px; margin-right: 10px; margin-top: 10px; margin-bottom: 10px; float: left; width: 245px; height: 100px; " />
<div id="MySignature" style="padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 255px; margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 2px; border-right-width: 2px; border-bottom-width: 2px; border-left-width: 2px; border-color: #4371a6; background-image: url(http://www.xxx.com/bk.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; background-position: 15px 50%; background-repeat: no-repeat no-repeat; "> <span style="color: #333333; line-height: 21px; ">作者：<a href="http://www.rixu.net" style="text-decoration: none; color: #000000; line-height: 24px; cursor: pointer; outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #333333; " target="_blank">Gezidan</a></span>
<div style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 25px; "> <span style="color: #333333; line-height: 21px; ">出处：<a href="http://www.rixu.net" style="text-decoration: none; color: #000000; line-height: 24px; cursor: pointer; outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #333333; " target="_blank">http://www.rixu.net</a>　　　　</span></div>
<div style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 25px; "> <span style="color: #333333; line-height: 21px; ">本文版权归作者和博客园共有，欢迎转载，但未经作者同意必须保留此段声明，且在文章页面明显位置给出原文连接，否则保留追究法律责任的权利。</span></div>
</div>
</div><img src ="http://www.cppblog.com/gezidan/aggbug/157949.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/gezidan/" target="_blank">Gezidan Studio</a> 2011-10-10 12:06 <a href="http://www.cppblog.com/gezidan/archive/2011/10/10/157949.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>C# HttpWebRequest 通用类(二)</title><link>http://www.cppblog.com/gezidan/archive/2011/09/28/157079.html</link><dc:creator>Gezidan Studio</dc:creator><author>Gezidan Studio</author><pubDate>Wed, 28 Sep 2011 05:52:00 GMT</pubDate><guid>http://www.cppblog.com/gezidan/archive/2011/09/28/157079.html</guid><wfw:comment>http://www.cppblog.com/gezidan/comments/157079.html</wfw:comment><comments>http://www.cppblog.com/gezidan/archive/2011/09/28/157079.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/gezidan/comments/commentRss/157079.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/gezidan/services/trackbacks/157079.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: using System;<br>using System.Collections.Generic;<br>using System.IO;<br>using System.Net;<br>using System.Text;<br><br>namespace HttpWeb<br>{<br>    /// <summary> <br>    ///  Http操作类 <br>    /// </summary> &nbsp;&nbsp;<a href='http://www.cppblog.com/gezidan/archive/2011/09/28/157079.html'>阅读全文</a><img src ="http://www.cppblog.com/gezidan/aggbug/157079.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/gezidan/" target="_blank">Gezidan Studio</a> 2011-09-28 13:52 <a href="http://www.cppblog.com/gezidan/archive/2011/09/28/157079.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>C# HttpWebRequest 通用类(一)</title><link>http://www.cppblog.com/gezidan/archive/2011/09/28/157078.html</link><dc:creator>Gezidan Studio</dc:creator><author>Gezidan Studio</author><pubDate>Wed, 28 Sep 2011 05:51:00 GMT</pubDate><guid>http://www.cppblog.com/gezidan/archive/2011/09/28/157078.html</guid><wfw:comment>http://www.cppblog.com/gezidan/comments/157078.html</wfw:comment><comments>http://www.cppblog.com/gezidan/archive/2011/09/28/157078.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/gezidan/comments/commentRss/157078.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/gezidan/services/trackbacks/157078.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: /*<br><br>使用方法：<br>MyHttp loHttp = new MyHttp();<br>string lcHtml = "";<br><br>loHttp.HandleCookies = true;//操作Cookies<br>loHttp.Method = "GET";<br>lcHtml = loHttp.GetUrl("http://signin.ebay.com.cn/ws2/eBayISAPI.dll?SignIn&ssPageName=h:h:sout:CN");<br><br>loHttp.AddPostKey("Key", "Value");<br>loHttp.Referer = "http://signin.ebay.com.cn/ws2/eBayISAPI.dll?SignIn&ssPageName=h:h:sout:CN";<br><br>loHttp.Method = "POST";<br>lcHtml = loHttp.GetUrl("http://signin.ebay.com.cn/ws2/eBayISAPI.&nbsp;&nbsp;<a href='http://www.cppblog.com/gezidan/archive/2011/09/28/157078.html'>阅读全文</a><img src ="http://www.cppblog.com/gezidan/aggbug/157078.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/gezidan/" target="_blank">Gezidan Studio</a> 2011-09-28 13:51 <a href="http://www.cppblog.com/gezidan/archive/2011/09/28/157078.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>C#三种模拟自动登录和提交POST信息的实现方法</title><link>http://www.cppblog.com/gezidan/archive/2011/09/28/157077.html</link><dc:creator>Gezidan Studio</dc:creator><author>Gezidan Studio</author><pubDate>Wed, 28 Sep 2011 05:40:00 GMT</pubDate><guid>http://www.cppblog.com/gezidan/archive/2011/09/28/157077.html</guid><wfw:comment>http://www.cppblog.com/gezidan/comments/157077.html</wfw:comment><comments>http://www.cppblog.com/gezidan/archive/2011/09/28/157077.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/gezidan/comments/commentRss/157077.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/gezidan/services/trackbacks/157077.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要:        网页自动登录（提交Post内容）的用途很多，如验证身份、程序升级、网络投票等，以下是用C#实现的方法。<br>       网页自动登录和提交POST信息的核心就是分析网页的源代码（HTML），在C#中，可以用来提取网页HTML的组件比较多，常用的用WebBrowser、WebClient、HttpWebRequest这三个。以下就分别用这三种方法来实现：&nbsp;&nbsp;<a href='http://www.cppblog.com/gezidan/archive/2011/09/28/157077.html'>阅读全文</a><img src ="http://www.cppblog.com/gezidan/aggbug/157077.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/gezidan/" target="_blank">Gezidan Studio</a> 2011-09-28 13:40 <a href="http://www.cppblog.com/gezidan/archive/2011/09/28/157077.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ASP.NET 也可以做得很好 2.XSLT初识 在ASP.NET中使用XSLT</title><link>http://www.cppblog.com/gezidan/archive/2011/09/28/157055.html</link><dc:creator>Gezidan Studio</dc:creator><author>Gezidan Studio</author><pubDate>Wed, 28 Sep 2011 02:33:00 GMT</pubDate><guid>http://www.cppblog.com/gezidan/archive/2011/09/28/157055.html</guid><wfw:comment>http://www.cppblog.com/gezidan/comments/157055.html</wfw:comment><comments>http://www.cppblog.com/gezidan/archive/2011/09/28/157055.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/gezidan/comments/commentRss/157055.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/gezidan/services/trackbacks/157055.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 大家说我说的跟.net一点关系都没有,可是第一篇我也说了啊，仅仅是一个HELLO的例子啊。现在哪个人不忙啊。只能一点一点的写了。。<br>好了，废话少说，我们先看看实际的情况，然后根据情况来写一个小小的例子吧，这次有Demo下载喽。。。<br>现实项目中的情况：&nbsp;&nbsp;<a href='http://www.cppblog.com/gezidan/archive/2011/09/28/157055.html'>阅读全文</a><img src ="http://www.cppblog.com/gezidan/aggbug/157055.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/gezidan/" target="_blank">Gezidan Studio</a> 2011-09-28 10:33 <a href="http://www.cppblog.com/gezidan/archive/2011/09/28/157055.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SLT 入门－－实际应用</title><link>http://www.cppblog.com/gezidan/archive/2011/09/28/157053.html</link><dc:creator>Gezidan Studio</dc:creator><author>Gezidan Studio</author><pubDate>Wed, 28 Sep 2011 02:27:00 GMT</pubDate><guid>http://www.cppblog.com/gezidan/archive/2011/09/28/157053.html</guid><wfw:comment>http://www.cppblog.com/gezidan/comments/157053.html</wfw:comment><comments>http://www.cppblog.com/gezidan/archive/2011/09/28/157053.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/gezidan/comments/commentRss/157053.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/gezidan/services/trackbacks/157053.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: <add key="Spider" value="Googlebot|Baiduspider|Yahoo! Slurp|YodaoBot|msnbot"/><br>把上面的代码加入web.config文件的appSettings节点中，别问为什么...<br>为Request写个扩展:&nbsp;&nbsp;<a href='http://www.cppblog.com/gezidan/archive/2011/09/28/157053.html'>阅读全文</a><img src ="http://www.cppblog.com/gezidan/aggbug/157053.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/gezidan/" target="_blank">Gezidan Studio</a> 2011-09-28 10:27 <a href="http://www.cppblog.com/gezidan/archive/2011/09/28/157053.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ASP.NET 也可以做得很好 1.XSLT初识 一个HELLO例子</title><link>http://www.cppblog.com/gezidan/archive/2011/09/28/157052.html</link><dc:creator>Gezidan Studio</dc:creator><author>Gezidan Studio</author><pubDate>Wed, 28 Sep 2011 02:24:00 GMT</pubDate><guid>http://www.cppblog.com/gezidan/archive/2011/09/28/157052.html</guid><wfw:comment>http://www.cppblog.com/gezidan/comments/157052.html</wfw:comment><comments>http://www.cppblog.com/gezidan/archive/2011/09/28/157052.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/gezidan/comments/commentRss/157052.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/gezidan/services/trackbacks/157052.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: XSL 指扩展样式表语言（EXtensible Stylesheet Language）<br>万维网联盟开始发展 XSL 的起因是由于对基于 XML 的样式表语言的需求。<br>XSLT 指 XSL 转换。XSLT 将 XML 文档转换为其他文档，比如 XHTML<br>概念不多讲,这里附上W3C的网址 ，希望您一定要去看看！<br>老规矩，先写出个能运行的程序再说。<br>既然XSLT是将XML文档转换为其它文档，那么我们就先建立一个XML文档吧。（名为：HelloHtml.xml）&nbsp;&nbsp;<a href='http://www.cppblog.com/gezidan/archive/2011/09/28/157052.html'>阅读全文</a><img src ="http://www.cppblog.com/gezidan/aggbug/157052.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/gezidan/" target="_blank">Gezidan Studio</a> 2011-09-28 10:24 <a href="http://www.cppblog.com/gezidan/archive/2011/09/28/157052.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ASP.NET性能优化之构建自定义文件缓存</title><link>http://www.cppblog.com/gezidan/archive/2011/09/28/157045.html</link><dc:creator>Gezidan Studio</dc:creator><author>Gezidan Studio</author><pubDate>Wed, 28 Sep 2011 01:43:00 GMT</pubDate><guid>http://www.cppblog.com/gezidan/archive/2011/09/28/157045.html</guid><wfw:comment>http://www.cppblog.com/gezidan/comments/157045.html</wfw:comment><comments>http://www.cppblog.com/gezidan/archive/2011/09/28/157045.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/gezidan/comments/commentRss/157045.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/gezidan/services/trackbacks/157045.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: ASP.NET的输出缓存（即静态HTML）在.NET4.0前一直是基于内存的。这意味着如果我们的站点含有大量的缓存，则很容易消耗掉本机内存。现在，借助于.NET4.0中的OutputCacheProvider，我们可以有多种选择创建自己的缓存。如，我们可以把HTML输出缓存存储到memcached分布式集群服务器，或者MongoDB中（一种常用的面向文档数据库，不妨阅读本篇http://msdn.microsoft.com/zh-cn/magazine/gg650661.aspx）。当然，我们也可以把缓存作为文件存储到硬盘上，考虑到可扩展性，这是一种最廉价的做法，本文就是介绍如果构建自定义文件缓存。&nbsp;&nbsp;<a href='http://www.cppblog.com/gezidan/archive/2011/09/28/157045.html'>阅读全文</a><img src ="http://www.cppblog.com/gezidan/aggbug/157045.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/gezidan/" target="_blank">Gezidan Studio</a> 2011-09-28 09:43 <a href="http://www.cppblog.com/gezidan/archive/2011/09/28/157045.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>C#winform程序如何与js交互</title><link>http://www.cppblog.com/gezidan/archive/2011/09/27/156975.html</link><dc:creator>Gezidan Studio</dc:creator><author>Gezidan Studio</author><pubDate>Tue, 27 Sep 2011 08:43:00 GMT</pubDate><guid>http://www.cppblog.com/gezidan/archive/2011/09/27/156975.html</guid><wfw:comment>http://www.cppblog.com/gezidan/comments/156975.html</wfw:comment><comments>http://www.cppblog.com/gezidan/archive/2011/09/27/156975.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/gezidan/comments/commentRss/156975.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/gezidan/services/trackbacks/156975.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="font-family: 'ms shell dlg'; line-height: 28px; background-color: #ffffff; ">
<p style="word-wrap: break-word; ">第一：</p>
<p style="word-wrap: break-word; ">JS代码</p>
<p style="word-wrap: break-word; "><code>&lt;script language=&#8221;javascript&#8221;&gt;<br style="clear: both; " />
function ShopXG(infor)<br style="clear: both; " />
{<br style="clear: both; " />
alert(&#8216;我要开网店、携购独立网店系统，模板最全，最专业的系统！&#8217;);<br style="clear: both; " />
return;<br style="clear: both; " />
}<br style="clear: both; " />
&lt;/script&gt;</code></p>
C#代码调用如下：
<p style="word-wrap: break-word; ">　　using System.Security.Permissions;</p>
<p style="word-wrap: break-word; ">　　注意： 类定义前需要加上下面两行，否则调用失败！</p>
<p style="word-wrap: break-word; ">　　[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]</p>
<p style="word-wrap: break-word; ">　　[System.Runtime.InteropServices.ComVisibleAttribute(true)]</p>
<p style="word-wrap: break-word; ">　　调用的函数：</p>
<p style="word-wrap: break-word; ">　　webBrowser1.Document.InvokeScript("ShopXG ", new string[] {&#8216;ssss&#8217;});</p>
<p style="word-wrap: break-word; ">第二：</p>
<p style="word-wrap: break-word; ">JS中调用c#函数示例</p>
C#函数如下：
<p style="word-wrap: break-word; "><code>public void ShowMessage(string message)<br style="clear: both; " />
{<br style="clear: both; " />
MessageBox.Show(&#8220;免费开网店，携购独立网店系统诚邀您的加盟！&#8221;);<br style="clear: both; " />
}</code></p>
JS里的调用方法：
<p style="word-wrap: break-word; "><code>&lt;script language=&#8221;javascript&#8221;&gt;<br style="clear: both; " />
function InvokeFunc()<br style="clear: both; " />
{<br style="clear: both; " />
window.external.ShowMessage(&#8216;呵呵&#8217;);<br style="clear: both; " />
}<br style="clear: both; " />
&lt;/script&gt;</code></p>
</span><br />
<br />
<div class="MySignatureBoard" style="padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 14px; line-height: 24px; min-height: 31px; overflow-x: hidden; overflow-y: hidden; word-wrap: break-word; word-break: break-all; "> <img alt="Logo" src="http://www.cppblog.com/images/cppblog_com/gezidan/17469/r_Rixu_net(245_100).png" style="padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px;border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; margin-left: 10px; margin-right: 10px; margin-top: 10px; margin-bottom: 10px; float: left; width: 245px; height: 100px; " />
<div id="MySignature" style="padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 255px; margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 2px; border-right-width: 2px; border-bottom-width: 2px; border-left-width: 2px; border-color: #4371a6; background-image: url(http://www.xxx.com/bk.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; background-position: 15px 50%; background-repeat: no-repeat no-repeat; "> <span style="color: #333333; line-height: 21px; ">作者：<a href="http://www.rixu.net" style="text-decoration: none; color: #000000; line-height: 24px; cursor: pointer; outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #333333; " target="_blank">Gezidan</a></span>
<div style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 25px; "> <span style="color: #333333; line-height: 21px; ">出处：<a href="http://www.rixu.net" style="text-decoration: none; color: #000000; line-height: 24px; cursor: pointer; outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #333333; " target="_blank">http://www.rixu.net</a>　　　　</span></div>
<div style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 25px; "> <span style="color: #333333; line-height: 21px; ">本文版权归作者和博客园共有，欢迎转载，但未经作者同意必须保留此段声明，且在文章页面明显位置给出原文连接，否则保留追究法律责任的权利。</span></div>
</div>
</div>
本文转载自&nbsp;http://www.cnblogs.com/wuhuisheng/archive/2011/04/18/2020013.html
<img src ="http://www.cppblog.com/gezidan/aggbug/156975.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/gezidan/" target="_blank">Gezidan Studio</a> 2011-09-27 16:43 <a href="http://www.cppblog.com/gezidan/archive/2011/09/27/156975.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>c#和javascript交互</title><link>http://www.cppblog.com/gezidan/archive/2011/09/27/156974.html</link><dc:creator>Gezidan Studio</dc:creator><author>Gezidan Studio</author><pubDate>Tue, 27 Sep 2011 08:41:00 GMT</pubDate><guid>http://www.cppblog.com/gezidan/archive/2011/09/27/156974.html</guid><wfw:comment>http://www.cppblog.com/gezidan/comments/156974.html</wfw:comment><comments>http://www.cppblog.com/gezidan/archive/2011/09/27/156974.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/gezidan/comments/commentRss/156974.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/gezidan/services/trackbacks/156974.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="color: #333333; font-family: verdana, ����, Arial; background-color: #ffffff; ">在asp.net开发中，经常会用到后台和前台的交互，就此总结了一点c#和javascript相互操作的方法&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: #ff0000; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; font-size: 14pt; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: #000000; font-size: 14pt; ">
<h3 style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 5px; padding-right: 0px; padding-bottom: 5px; padding-left: 5px; font-weight: bold; color: #ffffff; background-color: #668b8b; font-size: large; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: #000000; font-size: 14pt; ">1.在后台c#代码中调用jacascript的方法</span></h3>
<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
</span></span></span>javascript代码：&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
<div class="wp_codebox" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #eeefe6; border-left-style: solid; border-left-width: 3px; border-left-color: #4da9c2; border-top-style: dashed; border-top-width: 1px; border-top-color: #bbbbbb; border-right-style: dashed; border-right-width: 1px; border-right-color: #bbbbbb; border-bottom-style: dashed; border-bottom-width: 1px; border-bottom-color: #bbbbbb; font-family: Verdana, Helvetica, 微软雅黑, Arial, 宋体, sans-serif; background-position: initial initial; background-repeat: initial initial; ">
<pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: blue; ">&lt;</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: #a31515; ">script </span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: red; ">type</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: blue; ">="text/javascript" </span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: red; ">language</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: blue; ">="javascript"&gt;
function </span>test()
{
alert(<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: #a31515; ">"oec2003"</span>);
<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: blue; ">return false</span>;
}
<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: blue; ">&lt;/</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: #a31515; ">script</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: blue; ">&gt;</span></pre>
</div>
<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
c#代码：&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
<div class="wp_codebox" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #eeefe6; border-left-style: solid; border-left-width: 3px; border-left-color: #4da9c2; border-top-style: dashed; border-top-width: 1px; border-top-color: #bbbbbb; border-right-style: dashed; border-right-width: 1px; border-right-color: #bbbbbb; border-bottom-style: dashed; border-bottom-width: 1px; border-bottom-color: #bbbbbb; font-family: Verdana, Helvetica, 微软雅黑, Arial, 宋体, sans-serif; background-position: initial initial; background-repeat: initial initial; ">
<pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: blue; ">protected void </span>Button1_Click(<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: blue; ">object </span>sender, <span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: #2b91af; ">EventArgs </span>e)
{
ClientScript.RegisterStartupScript(<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: blue; ">this</span>.GetType(), <span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: #a31515; ">"clear"</span>, <span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: #a31515; ">"&lt;script&gt;test()&lt;/script&gt;"</span>);
}</pre>
</div>
<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; font-size: 12pt; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; font-size: 14pt; ">
<h3 style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 5px; padding-right: 0px; padding-bottom: 5px; padding-left: 5px; font-weight: bold; color: #ffffff; background-color: #668b8b; font-size: large; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; font-size: 14pt; ">2.javascript中调用c#方法</span></h3>
<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; font-size: 10pt; ">如果c#中的方法有返回值，可以用下面方法&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
c#代码&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
</span>
<div class="wp_codebox" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #eeefe6; border-left-style: solid; border-left-width: 3px; border-left-color: #4da9c2; border-top-style: dashed; border-top-width: 1px; border-top-color: #bbbbbb; border-right-style: dashed; border-right-width: 1px; border-right-color: #bbbbbb; border-bottom-style: dashed; border-bottom-width: 1px; border-bottom-color: #bbbbbb; font-family: Verdana, Helvetica, 微软雅黑, Arial, 宋体, sans-serif; background-position: initial initial; background-repeat: initial initial; ">
<pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: blue; ">public string </span>GetAuthStatus()
{
ViewState[<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: #a31515; ">"Auth"</span>] = <span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: #a31515; ">"Red"</span>;
<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: blue; ">return </span>ViewState[<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: #a31515; ">"Auth"</span>].ToString();
}</pre>
</div>
<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; font-size: 10pt; ">javascript代码&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
<div class="wp_codebox" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #eeefe6; border-left-style: solid; border-left-width: 3px; border-left-color: #4da9c2; border-top-style: dashed; border-top-width: 1px; border-top-color: #bbbbbb; border-right-style: dashed; border-right-width: 1px; border-right-color: #bbbbbb; border-bottom-style: dashed; border-bottom-width: 1px; border-bottom-color: #bbbbbb; font-family: Verdana, Helvetica, 微软雅黑, Arial, 宋体, sans-serif; background-position: initial initial; background-repeat: initial initial; ">
<pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: blue; ">&lt;</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: #a31515; ">script </span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: red; ">type</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: blue; ">="text/javascript" </span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: red; ">language</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: blue; ">="javascript"&gt;
function </span>getAuth()
{
<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: blue; ">var </span>authStatus = <span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: #a31515; ">"&lt;%=GetAuthStatus()%&gt;"</span>;
<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: blue; ">return </span>authStatus;
}
<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: blue; ">&lt;/</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: #a31515; ">script</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: blue; ">&gt;</span></pre>
</div>
<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
如果在javascript调用的c#方法没有返回值，可以在一面中放一个button，然后在button的单击事件中去写想做的事情，在客户端的脚本中写下如下代码就可以了&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />
<div class="wp_codebox" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #eeefe6; border-left-style: solid; border-left-width: 3px; border-left-color: #4da9c2; border-top-style: dashed; border-top-width: 1px; border-top-color: #bbbbbb; border-right-style: dashed; border-right-width: 1px; border-right-color: #bbbbbb; border-bottom-style: dashed; border-bottom-width: 1px; border-bottom-color: #bbbbbb; font-family: Verdana, Helvetica, 微软雅黑, Arial, 宋体, sans-serif; background-position: initial initial; background-repeat: initial initial; ">
<pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">document.all(<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.5; color: #a31515; ">"button1"</span>).click();</pre>
</div>
</span></span></span><br />
<div class="MySignatureBoard" style="padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-size: 14px; line-height: 24px; min-height: 31px; overflow-x: hidden; overflow-y: hidden; word-wrap: break-word; word-break: break-all; "> <img alt="Logo" src="http://www.cppblog.com/images/cppblog_com/gezidan/17469/r_Rixu_net(245_100).png" style="padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px;border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; margin-left: 10px; margin-right: 10px; margin-top: 10px; margin-bottom: 10px; float: left; width: 245px; height: 100px; " />
<div id="MySignature" style="padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 255px; margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 2px; border-right-width: 2px; border-bottom-width: 2px; border-left-width: 2px; border-color: #4371a6; background-image: url(http://www.xxx.com/bk.png); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; background-position: 15px 50%; background-repeat: no-repeat no-repeat; "> <span style="color: #333333; line-height: 21px; ">作者：<a href="http://www.rixu.net" style="text-decoration: none; color: #000000; line-height: 24px; cursor: pointer; outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #333333; " target="_blank">Gezidan</a></span>
<div style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 25px; "> <span style="color: #333333; line-height: 21px; ">出处：<a href="http://www.rixu.net" style="text-decoration: none; color: #000000; line-height: 24px; cursor: pointer; outline-style: none; outline-width: initial; outline-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #333333; " target="_blank">http://www.rixu.net</a>　　　　</span></div>
<div style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 25px; "> <span style="color: #333333; line-height: 21px; ">本文版权归作者和博客园共有，欢迎转载，但未经作者同意必须保留此段声明，且在文章页面明显位置给出原文连接，否则保留追究法律责任的权利。</span></div>
</div>
</div>
<br />
本文转载自&nbsp;http://www.cnblogs.com/oec2003/archive/2007/11/23/969638.html
<img src ="http://www.cppblog.com/gezidan/aggbug/156974.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/gezidan/" target="_blank">Gezidan Studio</a> 2011-09-27 16:41 <a href="http://www.cppblog.com/gezidan/archive/2011/09/27/156974.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>单点登录在项目中的实现</title><link>http://www.cppblog.com/gezidan/archive/2011/09/27/156938.html</link><dc:creator>Gezidan Studio</dc:creator><author>Gezidan Studio</author><pubDate>Tue, 27 Sep 2011 02:54:00 GMT</pubDate><guid>http://www.cppblog.com/gezidan/archive/2011/09/27/156938.html</guid><wfw:comment>http://www.cppblog.com/gezidan/comments/156938.html</wfw:comment><comments>http://www.cppblog.com/gezidan/archive/2011/09/27/156938.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/gezidan/comments/commentRss/156938.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/gezidan/services/trackbacks/156938.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 最近在做一个登录功能，纠结了好几天，一直在找一个能优雅的实现单点登录的功能。博客园有看到某人写了又臭又长的八股文式的文章，没看到有价值的东西。<br>其实单点登录最终要解决的是多个不同域名间共享cookie的问题。但是要在不同域名间共享cookie是一件很困难的事情，要在某个域名下面种cookie就必须访问该<br>域名。网上有很多方法，看到的有动态创建iframe实现，在iframe里面访问某个域名的页面种下cookie，该方法需要写一些js代码，写起来有点累，所以我最终<br>选择了用页面跳转来实现，想不到效果比我预期的好很多，浏览器几乎看不出来有跳转的痕迹。&nbsp;&nbsp;<a href='http://www.cppblog.com/gezidan/archive/2011/09/27/156938.html'>阅读全文</a><img src ="http://www.cppblog.com/gezidan/aggbug/156938.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/gezidan/" target="_blank">Gezidan Studio</a> 2011-09-27 10:54 <a href="http://www.cppblog.com/gezidan/archive/2011/09/27/156938.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>.NET中的加密算法总结(自定义加密Helper类)</title><link>http://www.cppblog.com/gezidan/archive/2011/09/26/156806.html</link><dc:creator>Gezidan Studio</dc:creator><author>Gezidan Studio</author><pubDate>Mon, 26 Sep 2011 01:48:00 GMT</pubDate><guid>http://www.cppblog.com/gezidan/archive/2011/09/26/156806.html</guid><wfw:comment>http://www.cppblog.com/gezidan/comments/156806.html</wfw:comment><comments>http://www.cppblog.com/gezidan/archive/2011/09/26/156806.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/gezidan/comments/commentRss/156806.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/gezidan/services/trackbacks/156806.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要:         相信许多人都使用过.NET提供的加密算法，而且在使用的过程我们必须了解每种加密算法的特点（对称或非对称，密钥长度和初始化向量等等）。我也看到过很多人写过.NET中加密算法总结，但我发现个别存在一些问题，很多人喜欢罗列每种加密算法的具体实现，假设我们要求实现AES和Triple DES加密算法，的确可以很多地分别给出它们的具体实现。<br>       那我们真的有必要给出每个加密算法的具体实现吗？而且这样的设计不符合OOP设计思想，最重要的是我们要维护多个加密算法啊！OK接下来让我们实行一个可扩展和好维护的加密算法Helper。&nbsp;&nbsp;<a href='http://www.cppblog.com/gezidan/archive/2011/09/26/156806.html'>阅读全文</a><img src ="http://www.cppblog.com/gezidan/aggbug/156806.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/gezidan/" target="_blank">Gezidan Studio</a> 2011-09-26 09:48 <a href="http://www.cppblog.com/gezidan/archive/2011/09/26/156806.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>C#.net连接Mysql的类库</title><link>http://www.cppblog.com/gezidan/archive/2011/08/24/154181.html</link><dc:creator>Gezidan Studio</dc:creator><author>Gezidan Studio</author><pubDate>Tue, 23 Aug 2011 16:09:00 GMT</pubDate><guid>http://www.cppblog.com/gezidan/archive/2011/08/24/154181.html</guid><wfw:comment>http://www.cppblog.com/gezidan/comments/154181.html</wfw:comment><comments>http://www.cppblog.com/gezidan/archive/2011/08/24/154181.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/gezidan/comments/commentRss/154181.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/gezidan/services/trackbacks/154181.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 微软的visual studio没有自带连接Mysql的驱动，要去网上下载一个mysql-connector-net-6.4.3驱动，然后安装就可以使用。<br>下面是我封装好的连接数据库的类，直接调用即可。<br>using System;<br>using System.Collections.Generic;<br>using System.Linq;<br>using System.Text;<br>using System.Data;<br>using System.Data.SqlClient;<br>using System.Configuration;<br>using MySql.Data.MySqlClient;&nbsp;&nbsp;<a href='http://www.cppblog.com/gezidan/archive/2011/08/24/154181.html'>阅读全文</a><img src ="http://www.cppblog.com/gezidan/aggbug/154181.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/gezidan/" target="_blank">Gezidan Studio</a> 2011-08-24 00:09 <a href="http://www.cppblog.com/gezidan/archive/2011/08/24/154181.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用C#制作印章</title><link>http://www.cppblog.com/gezidan/archive/2011/08/19/153873.html</link><dc:creator>Gezidan Studio</dc:creator><author>Gezidan Studio</author><pubDate>Fri, 19 Aug 2011 09:45:00 GMT</pubDate><guid>http://www.cppblog.com/gezidan/archive/2011/08/19/153873.html</guid><wfw:comment>http://www.cppblog.com/gezidan/comments/153873.html</wfw:comment><comments>http://www.cppblog.com/gezidan/archive/2011/08/19/153873.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/gezidan/comments/commentRss/153873.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/gezidan/services/trackbacks/153873.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 制作印章来说，主要是如何让字均匀的显示在弧线段上，那么一般的印章要么以圆或者椭圆为底图，不过这两者的算法大致相同，为了方便说明，如下就用相对简单的圆来举例说明，如果需要做椭圆的话，可以在我的基础上进行扩展，因为核心算法是一样的，相对于圆来说，椭圆求弧长以及各个字符的位置，这两点相对麻烦些，但是这两者都可找到相应的数学公式。&nbsp;&nbsp;<a href='http://www.cppblog.com/gezidan/archive/2011/08/19/153873.html'>阅读全文</a><img src ="http://www.cppblog.com/gezidan/aggbug/153873.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/gezidan/" target="_blank">Gezidan Studio</a> 2011-08-19 17:45 <a href="http://www.cppblog.com/gezidan/archive/2011/08/19/153873.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Ubuntu 服务器版安装mono记录</title><link>http://www.cppblog.com/gezidan/archive/2011/08/16/153587.html</link><dc:creator>Gezidan Studio</dc:creator><author>Gezidan Studio</author><pubDate>Tue, 16 Aug 2011 10:56:00 GMT</pubDate><guid>http://www.cppblog.com/gezidan/archive/2011/08/16/153587.html</guid><wfw:comment>http://www.cppblog.com/gezidan/comments/153587.html</wfw:comment><comments>http://www.cppblog.com/gezidan/archive/2011/08/16/153587.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/gezidan/comments/commentRss/153587.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/gezidan/services/trackbacks/153587.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;&nbsp;<a href='http://www.cppblog.com/gezidan/archive/2011/08/16/153587.html'>阅读全文</a><img src ="http://www.cppblog.com/gezidan/aggbug/153587.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/gezidan/" target="_blank">Gezidan Studio</a> 2011-08-16 18:56 <a href="http://www.cppblog.com/gezidan/archive/2011/08/16/153587.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>C#中使用XSLT文件将XML文档转换为HTML</title><link>http://www.cppblog.com/gezidan/archive/2011/08/15/153403.html</link><dc:creator>Gezidan Studio</dc:creator><author>Gezidan Studio</author><pubDate>Mon, 15 Aug 2011 01:53:00 GMT</pubDate><guid>http://www.cppblog.com/gezidan/archive/2011/08/15/153403.html</guid><wfw:comment>http://www.cppblog.com/gezidan/comments/153403.html</wfw:comment><comments>http://www.cppblog.com/gezidan/archive/2011/08/15/153403.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/gezidan/comments/commentRss/153403.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/gezidan/services/trackbacks/153403.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 1.创建XSLT文件，定义格式；<br>2.在C#中使用XslCompiledTransform对象的load()方法加载XSLT文件；<br>3.使用Transform()方法转换XML文档。&nbsp;&nbsp;<a href='http://www.cppblog.com/gezidan/archive/2011/08/15/153403.html'>阅读全文</a><img src ="http://www.cppblog.com/gezidan/aggbug/153403.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/gezidan/" target="_blank">Gezidan Studio</a> 2011-08-15 09:53 <a href="http://www.cppblog.com/gezidan/archive/2011/08/15/153403.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在服务器端将XML转换成HTML(C#)</title><link>http://www.cppblog.com/gezidan/archive/2011/08/15/153402.html</link><dc:creator>Gezidan Studio</dc:creator><author>Gezidan Studio</author><pubDate>Mon, 15 Aug 2011 01:53:00 GMT</pubDate><guid>http://www.cppblog.com/gezidan/archive/2011/08/15/153402.html</guid><wfw:comment>http://www.cppblog.com/gezidan/comments/153402.html</wfw:comment><comments>http://www.cppblog.com/gezidan/archive/2011/08/15/153402.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/gezidan/comments/commentRss/153402.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/gezidan/services/trackbacks/153402.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;&nbsp;<a href='http://www.cppblog.com/gezidan/archive/2011/08/15/153402.html'>阅读全文</a><img src ="http://www.cppblog.com/gezidan/aggbug/153402.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/gezidan/" target="_blank">Gezidan Studio</a> 2011-08-15 09:53 <a href="http://www.cppblog.com/gezidan/archive/2011/08/15/153402.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>json格式入门和总结</title><link>http://www.cppblog.com/gezidan/archive/2011/08/08/152759.html</link><dc:creator>Gezidan Studio</dc:creator><author>Gezidan Studio</author><pubDate>Mon, 08 Aug 2011 03:07:00 GMT</pubDate><guid>http://www.cppblog.com/gezidan/archive/2011/08/08/152759.html</guid><wfw:comment>http://www.cppblog.com/gezidan/comments/152759.html</wfw:comment><comments>http://www.cppblog.com/gezidan/archive/2011/08/08/152759.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/gezidan/comments/commentRss/152759.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/gezidan/services/trackbacks/152759.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要:       数据交换的格式，从结构上看，所有的数据（data）最终都可以分解成三种类型：<br><br>第一种类型是标量（scalar），也就是一个单独的字符串（string）或数字（numbers），比如"北京"这个单独的词。<br><br>第二种类型是序列（sequence），也就是若干个相关的数据按照一定顺序并列在一起，又叫做数组（array）或列表（List），比如"北京，上海"。<br><br>第三种类型是映射（mapping），也就是一个名/值对（Name/value），即数据有一个名称，还有一个与之相对应的值，这又称作散列（hash）或字典（dictionary），比如"首都：北京"。&nbsp;&nbsp;<a href='http://www.cppblog.com/gezidan/archive/2011/08/08/152759.html'>阅读全文</a><img src ="http://www.cppblog.com/gezidan/aggbug/152759.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/gezidan/" target="_blank">Gezidan Studio</a> 2011-08-08 11:07 <a href="http://www.cppblog.com/gezidan/archive/2011/08/08/152759.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>