<?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>nPath Ltd. &#187; VB.Net</title>
	<atom:link href="http://www.npathweb.com/tag/vbnet/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.npathweb.com</link>
	<description>Web Development Blog</description>
	<lastBuildDate>Tue, 10 Jan 2012 02:22:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Fun with site migration</title>
		<link>http://www.npathweb.com/2009/02/11/fun-with-site-migration/</link>
		<comments>http://www.npathweb.com/2009/02/11/fun-with-site-migration/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 19:25:11 +0000</pubDate>
		<dc:creator>B.Harding</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[ASP.net]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[VB.Net]]></category>
		<category><![CDATA[Visual Studio 2007]]></category>

		<guid isPermaLink="false">http://www.npathweb.com/?p=58</guid>
		<description><![CDATA[Here is my latest headache: Server Error in &#8216;/&#8217; Application. A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 [...]]]></description>
			<content:encoded><![CDATA[<p><span><br />
Here is my latest headache:</span></p>
<h1>Server Error in &#8216;/&#8217; Application.</h1>
<h1>
<hr size="1" /></h1>
<h2><em>A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 &#8211; Error Locating Server/Instance Specified)</em></h2>
<p>I recently migrated my dedicated server from the worthless company AIT to the cloud computing division of RackSpace. As a result I had to move my SQL database. No Problem I thought. I&#8217;ll just edit my web.config and go about my merry business. Well that is when the above error appeared.  This peticular site is dynamically compiled VB site with code in the aspx pages. (no code behind).</p>
<p>The data access layer is handled by some dataset files with XSD extentions. I found that when the files were created the web config connections strings were coppied but not dynamically linked. Each table adpter&#8217;s connection sting needed pointed at the web config again. The process was slow due to the now-remote database.</p>
<p>Now that the table adapters have updated their connection strings all is well.<em><br />
</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.npathweb.com/2009/02/11/fun-with-site-migration/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Insert with FormView using Linq</title>
		<link>http://www.npathweb.com/2009/02/05/insert-with-formview-using-linq/</link>
		<comments>http://www.npathweb.com/2009/02/05/insert-with-formview-using-linq/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 17:05:40 +0000</pubDate>
		<dc:creator>B.Harding</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[ASP.net]]></category>
		<category><![CDATA[Formview]]></category>
		<category><![CDATA[Linq]]></category>
		<category><![CDATA[VB.Net]]></category>

		<guid isPermaLink="false">http://www.npathweb.com/blog/?p=23</guid>
		<description><![CDATA[I had a wierd error trying to insert data using a formview today. The jist is this: the formview was trying to use an empty string for an int field instead of Nothing. Here is the error I saw, helpful huh? Failed to set one or more properties on type xxxxxxx  Ensure that the input values are [...]]]></description>
			<content:encoded><![CDATA[<p>I had a wierd error trying to insert data using a formview today.</p>
<p>The jist is this: the formview was trying to use an empty string for an int field instead of Nothing.<br />
Here is the error I saw, helpful huh?</p>
<p><span></p>
<h2><em><span style="color: #a52a2a;">Failed to set one or more properties on type xxxxxxx  Ensure that the input values are valid and can be converted to the corresponding property types.</span></em></h2>
<p></span></p>
<p>The fields are allowed to be null but the formview just isn&#8217;t smart enough to use nothing instead of &#8220;&#8221;.</p>
<p>My workaround was simple and flexible enough to be re-used so I figured I would post it here.<br />
I simply hijack the formview&#8217;s onInserting and replaced &#8220;&#8221; with Nothing for each field.</p>
<p><span style="font-size: x-small;"> </span></p>
<p><span style="color: #0000ff; font-size: x-small;">Protected</span><span style="font-size: x-small;"> </span><span style="color: #0000ff; font-size: x-small;">Sub</span><span style="font-size: x-small;"> formView1_ItemInserting(</span><span style="color: #0000ff; font-size: x-small;">ByVal</span><span style="font-size: x-small;"> sender </span><span style="color: #0000ff; font-size: x-small;">As</span><span style="font-size: x-small;"> </span><span style="color: #0000ff; font-size: x-small;">Object</span><span style="font-size: x-small;">, </span><span style="color: #0000ff; font-size: x-small;">ByVal</span><span style="font-size: x-small;"> e </span><span style="color: #0000ff; font-size: x-small;">As</span><span style="font-size: x-small;"> System.Web.UI.WebControls.FormViewInsertEventArgs)</span></p>
<p><span style="font-size: x-small;"> </span></p>
<p><span style="color: #0000ff; font-size: x-small;"> For</span><span style="font-size: x-small;"> </span><span style="color: #0000ff; font-size: x-small;">Each</span><span style="font-size: x-small;"> o </span><span style="color: #0000ff; font-size: x-small;">As</span><span style="font-size: x-small;"> DictionaryEntry </span><span style="color: #0000ff; font-size: x-small;">In</span><span style="font-size: x-small;"> e.Values<br />
</span><span style="color: #0000ff; font-size: x-small;">If</span><span style="font-size: x-small;"> o.Value = </span><span style="color: #a31515; font-size: x-small;">&#8220;&#8221;</span><span style="font-size: x-small;"> </span><span style="color: #0000ff; font-size: x-small;">Then</span><span style="font-size: x-small;"> e.Values(o.Key) = </span><span style="color: #0000ff; font-size: x-small;">Nothing<br />
</span><span style="color: #0000ff; font-size: x-small;"> Next</span></p>
<p><span style="font-size: x-small;"> </span></p>
<p><span style="color: #0000ff; font-size: x-small;">End</span><span style="font-size: x-small;"> </span><span style="color: #0000ff; font-size: x-small;">Sub</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.npathweb.com/2009/02/05/insert-with-formview-using-linq/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>switch to ssl automatically</title>
		<link>http://www.npathweb.com/2009/02/05/switch-to-ssl-automatically/</link>
		<comments>http://www.npathweb.com/2009/02/05/switch-to-ssl-automatically/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 17:04:06 +0000</pubDate>
		<dc:creator>B.Harding</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ASP.net]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[HTTPS]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[VB.Net]]></category>

		<guid isPermaLink="false">http://www.npathweb.com/blog/?p=21</guid>
		<description><![CDATA[In this post I&#8217;ll explain how I transparently switch from http to https This same snipit can be put on any page as is and forces certain pages to be https. The nice thing about it is that the user can not edit the url back to http on a page that has this. All [...]]]></description>
			<content:encoded><![CDATA[<p>In this post I&#8217;ll explain how I transparently switch from http to https</p>
<p>This same snipit can be put on any page as is and forces certain pages to be https. The nice thing about it is that the user can not edit the url back to http on a page that has this. All I did was put it on the login page and payment page.</p>
<p>On page load the server examines the Request.IsSecureConnection flag and redirects if not secure. It&#8217;s that simple. To make it a re-useble snipit I get the page name dynamically.</p>
<p>Be sure not to include the slash after your top level domain.</p>
<p><span style="font-size: x-small;"> </span></p>
<p><span style="color: #0000ff; font-size: x-small;">If</span><span style="font-size: x-small;"> </span><span style="color: #0000ff; font-size: x-small;">Not</span><span style="font-size: x-small;"> Page.IsPostBack </span><span style="color: #0000ff; font-size: x-small;">Then</span></p>
<p><span style="font-size: x-small;"> </span></p>
<p><span style="color: #0000ff; font-size: x-small;"> If</span><span style="font-size: x-small;"> </span><span style="color: #0000ff; font-size: x-small;">Not</span><span style="font-size: x-small;"> Request.IsSecureConnection </span><span style="color: #0000ff; font-size: x-small;">Then</span></p>
<p><span style="font-size: x-small;"> </span></p>
<p><span style="font-size: x-small;"> Response.Redirect(</span><span style="color: #800000; font-size: x-small;">&#8220;https://www.yourhostname.com&#8221;</span><span style="font-size: x-small;"> &amp; Request.Url.PathAndQuery.ToString)</span></p>
<p><span style="color: #0000ff; font-size: x-small;"> End</span><span style="font-size: x-small;"> </span><span style="color: #0000ff; font-size: x-small;">If</span></p>
<p><span style="font-size: x-small;"> </span></p>
<p><span style="color: #0000ff; font-size: x-small;">End</span><span style="font-size: x-small;"> </span><span style="color: #0000ff; font-size: x-small;">If</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.npathweb.com/2009/02/05/switch-to-ssl-automatically/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

