<?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; C#</title>
	<atom:link href="http://tt-house.com/tag/c/feed" rel="self" type="application/rss+xml" />
	<link>http://tt-house.com</link>
	<description>生涯一開発屋</description>
	<lastBuildDate>Fri, 03 Sep 2010 14:01:41 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>ClickOnce配布時のエラー</title>
		<link>http://tt-house.com/2009/07/clickonce.html</link>
		<comments>http://tt-house.com/2009/07/clickonce.html#comments</comments>
		<pubDate>Tue, 28 Jul 2009 14:22:16 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://www.tt-house.com//wp/?p=106</guid>
		<description><![CDATA[URLDownloadToCacheFile failed with HRES...]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Ftt-house.com%252F2009%252F07%252Fclickonce.html%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22ClickOnce%E9%85%8D%E5%B8%83%E6%99%82%E3%81%AE%E3%82%A8%E3%83%A9%E3%83%BC%22%20%7D);"></div>
<blockquote style="MARGIN-RIGHT: 0px" dir="ltr">
<p>URLDownloadToCacheFile failed with HRESULT &#8216;-2146697202&#8242;</p>
</blockquote>
<p dir="ltr">ClickOnceで配布したアプリケーションを起動しようとすると起動にコケました。エラーログを辿ると上記のログが。エラーからググったんですけど、どうにもわかんなかったんですね。</p>
<p dir="ltr">で、思い当たったのが第三者機関が証明書を発行していないオレオレ証明書。</p>
<p dir="ltr">これがビンゴだったわけですよ。社内でしか使わないアプリケーションなので証明書にコストも掛けられず、かといってプレーンな状態でデータのやり取りもしたくなく、オレオレ証明書を使っていたわけですが、それがよくなかった様子。証明書のインポートをしたら無事に起動しました。</p>
<p dir="ltr">&nbsp;</p>

]]></content:encoded>
			<wfw:commentRss>http://tt-house.com/2009/07/clickonce.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C#でXMLからLINQtoXMLで必要な情報だけ抜き出してDataGridViewにバインドする</title>
		<link>http://tt-house.com/2009/07/linqtoxml-bind-datagridview.html</link>
		<comments>http://tt-house.com/2009/07/linqtoxml-bind-datagridview.html#comments</comments>
		<pubDate>Thu, 09 Jul 2009 10:43:53 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[LINQ]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.tt-house.com//wp/?p=105</guid>
		<description><![CDATA[最近RubyonRailsのエントリーばっかりだったのですが、別にそれしかやって...]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Ftt-house.com%252F2009%252F07%252Flinqtoxml-bind-datagridview.html%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22C%23%E3%81%A7XML%E3%81%8B%E3%82%89LINQtoXML%E3%81%A7%E5%BF%85%E8%A6%81%E3%81%AA%E6%83%85%E5%A0%B1%E3%81%A0%E3%81%91%E6%8A%9C%E3%81%8D%E5%87%BA%E3%81%97%E3%81%A6DataGridView%E3%81%AB%E3%83%90%E3%82%A4%E3%83%B3%E3%83%89%E3%81%99%E3%82%8B%22%20%7D);"></div>
<p>最近RubyonRailsのエントリーばっかりだったのですが、別にそれしかやっていないわけではありません。プロジェクトも並行で同時進行、言語もまちまち。なんとか混乱しないでこなしていますが、堤防決壊寸前ですな。</p>
<blockquote style="MARGIN-RIGHT: 0px" dir="ltr">
<p>XDocument doc = XDocument.Parse(XMLの形をした文字列);<br />var query = from n in doc.Descendants(&#8220;user&#8221;)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; select new {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; id = n.Element(&#8220;id&#8221;).Value,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; user_name = n.Element(&#8220;user_name&#8221;).Value,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; telephone = n.Element(&#8220;telephone&#8221;).Value<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };</p>
<p>データグリッド.DataSource = query.ToList();</p>
</blockquote>
<p dir="ltr">XMLファイルをXDocumentに読み込む場合は</p>
<blockquote style="MARGIN-RIGHT: 0px" dir="ltr">
<p dir="ltr">XDocument.Load(ファイルパス);</p>
</blockquote>
<p dir="ltr">となります。</p>
<p dir="ltr">LINQtoXMLで必要なノードだけを抽出して（今回は「user」というノードだけを抜き出しています）、データグリッドにバインドしています。</p>
<p dir="ltr">バインドするのはLINQの結果のままの状態ではなく、IListに明示的に変換してあげなければいけません。変換してやら無いとIEnumerableのままなのかな？バインドしてもデータグリッドに何も表示されませんでした。</p>
<p dir="ltr">コレを解決するのに半日悩んだ。。。</p>

]]></content:encoded>
			<wfw:commentRss>http://tt-house.com/2009/07/linqtoxml-bind-datagridview.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C#で桁埋め（ゼロパディング）</title>
		<link>http://tt-house.com/2008/11/csharp_padding.html</link>
		<comments>http://tt-house.com/2008/11/csharp_padding.html#comments</comments>
		<pubDate>Fri, 07 Nov 2008 10:40:38 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://www.tt-house.com//wp/?p=72</guid>
		<description><![CDATA[Console.WriteLine( String.Format("{0:D2...]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Ftt-house.com%252F2008%252F11%252Fcsharp_padding.html%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22C%23%E3%81%A7%E6%A1%81%E5%9F%8B%E3%82%81%EF%BC%88%E3%82%BC%E3%83%AD%E3%83%91%E3%83%87%E3%82%A3%E3%83%B3%E3%82%B0%EF%BC%89%22%20%7D);"></div>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
<p>Console.WriteLine( String.Format(&#8220;{0:D2}&#8221;,3) );</p>
</blockquote>
<p>出力結果は「03」です。Dで10進数と指定、2で2桁にパディング、最後の3が「これをパディングしてくださ」っていう感じです。</p>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
<p>Console.WriteLine(String.Format(&#8220;{0,4}&#8221;,3) );</p>
</blockquote>
<p>だと、「&nbsp;&nbsp; 3」と出力されます。4桁にスペースパディングです。固定長出力時に利用します。でも固定長っていまでも使うのかなぁ。</p>

]]></content:encoded>
			<wfw:commentRss>http://tt-house.com/2008/11/csharp_padding.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C#で四捨五入</title>
		<link>http://tt-house.com/2008/09/c.html</link>
		<comments>http://tt-house.com/2008/09/c.html#comments</comments>
		<pubDate>Mon, 08 Sep 2008 11:33:54 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://www.tt-house.com//wp/?p=63</guid>
		<description><![CDATA[2.0以降専用です。 Math.Round(対象数字,0,MidpointRou...]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Ftt-house.com%252F2008%252F09%252Fc.html%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22C%23%E3%81%A7%E5%9B%9B%E6%8D%A8%E4%BA%94%E5%85%A5%22%20%7D);"></div>
<p>2.0以降専用です。</p>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
<p>Math.Round(対象数字,0,MidpointRounding.AwayFromZero);</p>
</blockquote>
<p dir="ltr">二つ目の引数は、「第何位まで求めるか」です。上記例だと0なので整数値にしてくれます。1.1では四捨五入はなかったので、自作した覚えがあります。</p>
<p dir="ltr">便利になったもんですね。</p>
<p dir="ltr">三つ目の引数を「MidpointRounding.ToEven」にすると丸めてくれます。これは普通に「Math.Round」でもいいと思うので、四捨五入用と思ってもいいのかもしれません。</p>

]]></content:encoded>
			<wfw:commentRss>http://tt-house.com/2008/09/c.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C#で文字列が整数値か判定する</title>
		<link>http://tt-house.com/2008/02/c_4.html</link>
		<comments>http://tt-house.com/2008/02/c_4.html#comments</comments>
		<pubDate>Mon, 11 Feb 2008 10:07:05 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://www.tt-house.com//wp/?p=49</guid>
		<description><![CDATA[Parseしてcatchするかどうかの判定でもいいのですが、いまいちスマートじゃ...]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Ftt-house.com%252F2008%252F02%252Fc_4.html%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22C%23%E3%81%A7%E6%96%87%E5%AD%97%E5%88%97%E3%81%8C%E6%95%B4%E6%95%B0%E5%80%A4%E3%81%8B%E5%88%A4%E5%AE%9A%E3%81%99%E3%82%8B%22%20%7D);"></div>
<p>Parseしてcatchするかどうかの判定でもいいのですが、いまいちスマートじゃないなぁと。</p>
<p>そしたら2.0からTryParseなるメソッドが追加されていました。<br />いやー、不勉強ここにいたるという感じですな。</p>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
<p>int intReturn;<br />Console.WriteLine (int.TryParse(&#8220;hoge&#8221;,out intReturn));</p>
</blockquote>
<p dir="ltr">上記例だとFalseが出力されます。</p>
<p dir="ltr">第一引数&#8221;hoge&#8221;が整数か否かを判定して、「ちげーよ」っていう結果が出てるんですよね。整数だったらTrueが返ります。boolです。</p>
<p dir="ltr">また、Falseの場合にはintReturnに「0（ゼロ）」がセットされます。Falseの0なんですけど、何に使うのかがわかりませんでした。せめて初期値を指定できて、Falseならその値が返ってくれればいいのですが、一行目を</p>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
<p dir="ltr">int intReturn = 1234;</p>
</blockquote>
<p dir="ltr">としておいても、0が返ります。</p>
<p dir="ltr">&nbsp;</p>

]]></content:encoded>
			<wfw:commentRss>http://tt-house.com/2008/02/c_4.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C#で日付をフォーマット指定して文字列にする</title>
		<link>http://tt-house.com/2008/01/c_3.html</link>
		<comments>http://tt-house.com/2008/01/c_3.html#comments</comments>
		<pubDate>Sat, 05 Jan 2008 07:36:07 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://www.tt-house.com//wp/?p=47</guid>
		<description><![CDATA[String.Format("{0:yyyyMMdd}",DateTime.N...]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Ftt-house.com%252F2008%252F01%252Fc_3.html%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22C%23%E3%81%A7%E6%97%A5%E4%BB%98%E3%82%92%E3%83%95%E3%82%A9%E3%83%BC%E3%83%9E%E3%83%83%E3%83%88%E6%8C%87%E5%AE%9A%E3%81%97%E3%81%A6%E6%96%87%E5%AD%97%E5%88%97%E3%81%AB%E3%81%99%E3%82%8B%22%20%7D);"></div>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
<p>String.Format(&#8220;{0:yyyyMMdd}&#8221;,DateTime.Now)</p>
</blockquote>
<p dir="ltr">まぁこれだけの話なのですが、しょっちゅう書き方忘れるので備忘録に。</p>

]]></content:encoded>
			<wfw:commentRss>http://tt-house.com/2008/01/c_3.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C#でコンボボックスのSelectedIndexを値から指定する</title>
		<link>http://tt-house.com/2008/01/cselectedindex.html</link>
		<comments>http://tt-house.com/2008/01/cselectedindex.html#comments</comments>
		<pubDate>Fri, 04 Jan 2008 08:57:54 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://www.tt-house.com//wp/?p=46</guid>
		<description><![CDATA[string[] strMonth = { "1", "2", "3", "4...]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Ftt-house.com%252F2008%252F01%252Fcselectedindex.html%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22C%23%E3%81%A7%E3%82%B3%E3%83%B3%E3%83%9C%E3%83%9C%E3%83%83%E3%82%AF%E3%82%B9%E3%81%AESelectedIndex%E3%82%92%E5%80%A4%E3%81%8B%E3%82%89%E6%8C%87%E5%AE%9A%E3%81%99%E3%82%8B%22%20%7D);"></div>
<blockquote>
<p>string[] strMonth = { &#8220;1&#8243;, &#8220;2&#8243;, &#8220;3&#8243;, &#8220;4&#8243;, &#8220;5&#8243;, &#8220;6&#8243;, &#8220;7&#8243;, &#8220;8&#8243;, &#8220;9&#8243;, &#8220;10&#8243;, &#8220;11&#8243;, &#8220;12&#8243;,};<br />cmbMonth.Items.AddRange(strMonth);<br />cmbMonth.SelectedIndex = cmbMonth.FindString(DateTime.Now.Month.ToString());</p>
</blockquote>
<p>&nbsp;</p>
<p>例として、cmbMonthというコンボボックスに1月から12月までの値を入れています。そして、今月をSelectedIndexに指定しています。FindStringメソッドで当月が格納されているitemindexを求めて、それをselectedindexに指定しているだけ。</p>
<p>これって2.0からでしょうね。確か1.1のころはこんな便利なメソッドはなかった。</p>

]]></content:encoded>
			<wfw:commentRss>http://tt-house.com/2008/01/cselectedindex.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C#でPDF</title>
		<link>http://tt-house.com/2007/12/cpdf.html</link>
		<comments>http://tt-house.com/2007/12/cpdf.html#comments</comments>
		<pubDate>Mon, 31 Dec 2007 09:11:29 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[iText]]></category>
		<category><![CDATA[PDF]]></category>

		<guid isPermaLink="false">http://www.tt-house.com//wp/?p=44</guid>
		<description><![CDATA[最近帳票出力が必要なWindowsアプリケーションの開発をやっています。帳票はP...]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Ftt-house.com%252F2007%252F12%252Fcpdf.html%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22C%23%E3%81%A7PDF%22%20%7D);"></div>
<p>最近帳票出力が必要なWindowsアプリケーションの開発をやっています。帳票はPDF。ActiveReportとかを買うお金はありません。ということで、<a href="http://www.ujihara.jp/iTextdotNET/ja/index.html">iText.NET</a>。</p>
<p>&nbsp;</p>
<p>フリーなのにとってもよくできているのですが、いまいち思ったとおりに動いてくれない。まぁこれは僕のセンスの問題なのですが。。。</p>
<p>&nbsp;</p>
<p>もうちょっとしたらTipsをまとめて書けそう。忘れないうちに書かないと。。。</p>

]]></content:encoded>
			<wfw:commentRss>http://tt-house.com/2007/12/cpdf.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DataGridViewのフォントサイズの変更</title>
		<link>http://tt-house.com/2007/07/datagridview.html</link>
		<comments>http://tt-house.com/2007/07/datagridview.html#comments</comments>
		<pubDate>Fri, 06 Jul 2007 02:24:01 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://www.tt-house.com//wp/?p=37</guid>
		<description><![CDATA[プロパティウィンドウにフォントサイズなる項目がなかったような気がして不安になった...]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Ftt-house.com%252F2007%252F07%252Fdatagridview.html%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22DataGridView%E3%81%AE%E3%83%95%E3%82%A9%E3%83%B3%E3%83%88%E3%82%B5%E3%82%A4%E3%82%BA%E3%81%AE%E5%A4%89%E6%9B%B4%22%20%7D);"></div>
<p>プロパティウィンドウにフォントサイズなる項目がなかったような気がして不安になったのですが、コードから指定したら簡単にできてしまいました。</p>
<blockquote><p>DataGridViewの名称.Font = new Font(DataGridViewの名称.Font.Name, 22);</p></blockquote>
<p>これでデフォルトフォントのままでサイズだけが22になります。<br />
でも、カラムのheightも合わせて指定しないと悲しいことになります。勝手に拡大してくれたら幸せになれたのに。。。</p>

]]></content:encoded>
			<wfw:commentRss>http://tt-house.com/2007/07/datagridview.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C#でベーシック認証が必要なページのデータを取得する方法</title>
		<link>http://tt-house.com/2007/06/c-2-2.html</link>
		<comments>http://tt-house.com/2007/06/c-2-2.html#comments</comments>
		<pubDate>Fri, 08 Jun 2007 17:57:48 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://www.tt-house.com//wp/?p=32</guid>
		<description><![CDATA[//もしかすると名前空間足りないかも using System.Text; u...]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Ftt-house.com%252F2007%252F06%252Fc-2-2.html%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22C%23%E3%81%A7%E3%83%99%E3%83%BC%E3%82%B7%E3%83%83%E3%82%AF%E8%AA%8D%E8%A8%BC%E3%81%8C%E5%BF%85%E8%A6%81%E3%81%AA%E3%83%9A%E3%83%BC%E3%82%B8%E3%81%AE%E3%83%87%E3%83%BC%E3%82%BF%E3%82%92%E5%8F%96%E5%BE%97%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95%22%20%7D);"></div>
<blockquote><p>//もしかすると名前空間足りないかも</p>
<p>using System.Text;<br />
using System.IO;<br />
using System.Net;<br />
using System.Web;<br />
using System.Collections;</p>
<p>//相手のCGIはeuc-jpで書かれています。<br />
Encoding encEuc = Encoding.GetEncoding(&#8220;euc-jp&#8221;);</p>
<p>//POSTするデータの作成、URLエンコードが必要です。<br />
byte[] data = Encoding.ASCII.GetBytes(&#8220;data=&#8221; + HttpUtility.UrlEncode(&#8220;C#からベーシック認証の向こうにPOSTしてみました。&#8221;, encEuc));</p>
<p>//WebRequestの作成<br />
HttpWebRequest webreq = (HttpWebRequest)WebRequest.Create(CGIのURL);</p>
<p>//POSTでURLエンコードされたデータを送信しますという宣言<br />
webreq.Method = &#8220;POST&#8221;;<br />
webreq.ContentType = &#8220;application/x-www-form-urlencoded&#8221;;</p>
<p>//ベーシック認証使うよ宣言と、次にアカウントとパスワード<br />
webreq.PreAuthenticate = true;<br />
NetworkCredential network = new NetworkCredential(アカウント,パスワード);<br />
webreq.Credentials = network;</p>
<p>//何バイト送るよ<br />
webreq.ContentLength = data.Length;</p>
<p>//送信ストリーム<br />
Stream webreq_stream = webreq.GetRequestStream();<br />
webreq_stream.Write(data, 0, data.Length);<br />
webreq_stream.Close();</p>
<p>//受信ストリーム<br />
WebResponse webres = webreq.GetResponse();<br />
Stream webres_stream = webres.GetResponseStream();</p>
<p>//受信ストリームの読み込みと、クローズ<br />
StreamReader stream = new StreamReader(webres_stream, encEuc);<br />
string strGetData = stream.ReadToEnd();<br />
stream.Close();<br />
webreq_stream.Close();</p>
<p>//受信したら書き出そう<br />
System.Console.Write(strGetData);</p></blockquote>
<p>Webサービス使えない状況だとやっぱりCGI経由になるわけですが、大事なデータはやっぱりベーシック認証なんかで守られてるわけですよ。しかもGETでクエリつけたらログに残っちゃいますしね。</p>
<p>というわけで、上記の手法を探っておりました。</p>

]]></content:encoded>
			<wfw:commentRss>http://tt-house.com/2007/06/c-2-2.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
