<?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>Avivo Tech Blog &#187; ASP.NET</title>
	<atom:link href="http://tech.avivo.si/tag/aspnet/feed/" rel="self" type="application/rss+xml" />
	<link>http://tech.avivo.si</link>
	<description>Solving problems</description>
	<lastBuildDate>Tue, 24 Jan 2012 14:46:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Parsing URL query string into key-value pairs in C#</title>
		<link>http://tech.avivo.si/2010/12/parsing-url-query-string-into-key-value-pairs-in-c/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=parsing-url-query-string-into-key-value-pairs-in-c</link>
		<comments>http://tech.avivo.si/2010/12/parsing-url-query-string-into-key-value-pairs-in-c/#comments</comments>
		<pubDate>Fri, 03 Dec 2010 12:08:31 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[Programming Techniques]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[key-value pairs from query string]]></category>
		<category><![CDATA[parsing query string]]></category>
		<category><![CDATA[query string]]></category>
		<category><![CDATA[url]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=917</guid>
		<description><![CDATA[Imagine you have URL something like this: http://www.yourdomain.com?param1=value1&#38;param2=value2&#38;param3=value3&#38;param4=value4 and you want to get key-value pairs such as {&#8220;param1&#8243;, &#8220;param2&#8243;, &#8220;param3&#8243;, &#8220;param4&#8243;} {&#8220;value1&#8243;, &#8220;value2&#8243;, &#8220;value3&#8243;, &#8220;value4&#8243;} It is easy to do using system function: using System.Collections.Specialized; NameValueCollection query = HttpUtility.ParseQueryString(queryString); Response.Write(query["param1"]);]]></description>
			<content:encoded><![CDATA[<p>Imagine you have URL something like this:</p>
<p><strong>http://www.yourdomain.com?param1=value1&amp;param2=value2&amp;param3=value3&amp;param4=value4</strong></p>
<p>and you want to get key-value pairs such as</p>
<ul>
<li>{&#8220;param1&#8243;, &#8220;param2&#8243;, &#8220;param3&#8243;, &#8220;param4&#8243;}</li>
<li>{&#8220;value1&#8243;, &#8220;value2&#8243;, &#8220;value3&#8243;, &#8220;value4&#8243;}</li>
</ul>
<p>It is easy to do using system function:</p>
<pre class=charp>
using System.Collections.Specialized;
NameValueCollection query = HttpUtility.ParseQueryString(queryString);
Response.Write(query["param1"]);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2010/12/parsing-url-query-string-into-key-value-pairs-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>System.Web.HttpException: Request is not available in this context</title>
		<link>http://tech.avivo.si/2010/02/system-web-httpexception-request-is-not-available-in-this-context/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=system-web-httpexception-request-is-not-available-in-this-context</link>
		<comments>http://tech.avivo.si/2010/02/system-web-httpexception-request-is-not-available-in-this-context/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 13:19:25 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[Programming Techniques]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[page cycle]]></category>
		<category><![CDATA[Request]]></category>
		<category><![CDATA[Request is not available in this context]]></category>
		<category><![CDATA[System.Web.HttpException]]></category>
		<category><![CDATA[System.Web.HttpException: Request is not available in this context]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=398</guid>
		<description><![CDATA[Use HttpContext.Current.Request instead of Request i.e. HttpContext.Current.Request.UserHostAddress not Request.UserHostAddress]]></description>
			<content:encoded><![CDATA[<p>Use <strong>HttpContext.Current.Request </strong>instead of <strong>Request</strong></p>
<p>i.e.</p>
<p><strong>HttpContext.Current.Request.UserHostAddress</strong></p>
<p>not</p>
<p><strong>Request.UserHostAddress</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2010/02/system-web-httpexception-request-is-not-available-in-this-context/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Comparison: ASP .NET WebForms vs MVC</title>
		<link>http://tech.avivo.si/2010/01/comparison-asp-net-webforms-vs-mvc/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=comparison-asp-net-webforms-vs-mvc</link>
		<comments>http://tech.avivo.si/2010/01/comparison-asp-net-webforms-vs-mvc/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 22:41:44 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[event model]]></category>
		<category><![CDATA[iis]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[view-model-controller]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://blog.sweetucan.com/?p=132</guid>
		<description><![CDATA[Comparison: ASP .NET WebForms vs MVC WebForms MVC Requires .NET 2.0 Event model &#8211; button click triggers an event in code-behind ViewState &#8211; server-based forms for easier management Existing third party controls Requires .NET 3.5 and MVC library Requires IIS 6.0 or later for URL rewritting &#8211; btw, max IIS version for WinXP is 5.1 [...]]]></description>
			<content:encoded><![CDATA[<p>Comparison: ASP .NET WebForms vs MVC</p>
<table border="0">
<tbody>
<tr>
<td>WebForms</td>
<td>MVC</td>
</tr>
<tr style="vertical-align: top">
<td>
<ul>
<li>Requires .NET 2.0</li>
<li>Event model &#8211; button click triggers an event in code-behind</li>
<li>ViewState &#8211; server-based forms for easier management</li>
<li>Existing third party controls</li>
</ul>
</td>
<td>
<li><span style="color: #800000;">Requires .NET 3.5 and MVC library</span></li>
<li><span style="color: #800000;">Requires IIS 6.0 or later for URL rewritting &#8211; btw, max IIS version for WinXP is 5.1</span></li>
<li>Backward compatible &#8211; developer can include WebForms pages into MVC website and vice-versa</li>
<li>Dividing an application into the model, the view, and the controller &#8211; <span style="color: #008000;">data, design and code are separated</span></li>
<li>For large teams of developers and designers (parallel work)</li>
<li>No ViewState means <span style="color: #008000;">smaller output and cleaner html</span></li>
<li><span style="color: #008000;">Portable</span> among other languages (like php) &#8211; similar file hierarchy, object names, different syntax</li>
<li><span style="color: #008000;">30-50% faster than Web Forms, 100-800 requests per second</span></li>
<li>Native URL rewritting</li>
<li><span style="color: #008000;">Skinnable</span>, suitable for websites that are viewed in computer browsers and mobile browsers</li>
<li>Unit testing</li>
</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2010/01/comparison-asp-net-webforms-vs-mvc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IF WRN: Assembly binding logging is turned OFF or It is an error to use a section registered as allowDefinition=&#8217;MachineToApplication&#8217; beyond application level</title>
		<link>http://tech.avivo.si/2009/12/if-wrn-assembly-binding-logging-is-turned-off-or-it-is-an-error-to-use-a-section-registered-as-allowdefinitionmachinetoapplication-beyond-application-level/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=if-wrn-assembly-binding-logging-is-turned-off-or-it-is-an-error-to-use-a-section-registered-as-allowdefinitionmachinetoapplication-beyond-application-level</link>
		<comments>http://tech.avivo.si/2009/12/if-wrn-assembly-binding-logging-is-turned-off-or-it-is-an-error-to-use-a-section-registered-as-allowdefinitionmachinetoapplication-beyond-application-level/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 11:58:39 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Assembly binding logging is turned OFF]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[iis7]]></category>
		<category><![CDATA[It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[web.config error]]></category>
		<category><![CDATA[windows 2008 server]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=234</guid>
		<description><![CDATA[We had some problems with subdirectories under our root website. We wanted to add different examples under our website root (organized into folders) like this: www.our-website.com/example1 www.our-website.com/example2 &#8230; And we always got these errors. At root of our website www.our-website.com we didn&#8217;t have any web.config and we didn&#8217;t want any. Every subfolder has its own [...]]]></description>
			<content:encoded><![CDATA[<p>We had some problems with subdirectories under our root website.</p>
<p>We wanted to add different examples under our website root (organized into folders) like this:</p>
<ul>
<li>www.our-website.com/example1</li>
<li>www.our-website.com/example2</li>
<li>&#8230;</li>
</ul>
<p>And we always got these errors.</p>
<p>At root of our website www.our-website.com we didn&#8217;t have any web.config and we didn&#8217;t want any. Every subfolder has its own web.config and it didn&#8217;t worked under IIS7</p>
<p>Solution:</p>
<p>Click on each folder under IIS and then right mouse click <strong>Convert To Application</strong> and it worked.</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2009/12/if-wrn-assembly-binding-logging-is-turned-off-or-it-is-an-error-to-use-a-section-registered-as-allowdefinitionmachinetoapplication-beyond-application-level/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Saving high quality JPG in C# or ASP.NET</title>
		<link>http://tech.avivo.si/2009/11/saving-high-quality-jpg-in-c-or-aspnet/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=saving-high-quality-jpg-in-c-or-aspnet</link>
		<comments>http://tech.avivo.si/2009/11/saving-high-quality-jpg-in-c-or-aspnet/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 15:17:29 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[Programming Techniques]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[encoding]]></category>
		<category><![CDATA[high quality jpg]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[jpg]]></category>
		<category><![CDATA[processing]]></category>
		<category><![CDATA[saving]]></category>

		<guid isPermaLink="false">http://blog.sweetucan.com/?p=198</guid>
		<description><![CDATA[Just use this piece of code or read at this MSDN article: private void VaryQualityLevel() { // Get a bitmap. Bitmap bmp1 = new Bitmap(@"c:\TestPhoto.jpg"); ImageCodecInfo jgpEncoder = GetEncoder(ImageFormat.Jpeg); // Create an Encoder object based on the GUID // for the Quality parameter category. System.Drawing.Imaging.Encoder myEncoder = System.Drawing.Imaging.Encoder.Quality; // Create an EncoderParameters object. // An [...]]]></description>
			<content:encoded><![CDATA[<p>Just use this piece of code or read <a href="http://msdn.microsoft.com/en-us/library/system.drawing.imaging.encoderparameter.aspx" target="_self">at this MSDN article</a>:</p>
<pre class="c-sharp">private void VaryQualityLevel()
{
	// Get a bitmap.
	Bitmap bmp1 = new Bitmap(@"c:\TestPhoto.jpg");
	ImageCodecInfo jgpEncoder = GetEncoder(ImageFormat.Jpeg);

	// Create an Encoder object based on the GUID
	// for the Quality parameter category.
	System.Drawing.Imaging.Encoder myEncoder =
	System.Drawing.Imaging.Encoder.Quality;

	// Create an EncoderParameters object.
	// An EncoderParameters object has an array of EncoderParameter
	// objects. In this case, there is only one
	// EncoderParameter object in the array.
	EncoderParameters myEncoderParameters = new EncoderParameters(1);

	EncoderParameter myEncoderParameter = new EncoderParameter(myEncoder, 50L);
	myEncoderParameters.Param[0] = myEncoderParameter;
	bmp1.Save(@"c:\TestPhotoQualityFifty.jpg", jgpEncoder, myEncoderParameters);

	myEncoderParameter = new EncoderParameter(myEncoder, 100L);
	myEncoderParameters.Param[0] = myEncoderParameter;
	bmp1.Save(@"c:\TestPhotoQualityHundred.jpg", jgpEncoder, myEncoderParameters);

	// Save the bitmap as a JPG file with zero quality level compression.
	myEncoderParameter = new EncoderParameter(myEncoder, 0L);
	myEncoderParameters.Param[0] = myEncoderParameter;
	bmp1.Save(@"c:\TestPhotoQualityZero.jpg", jgpEncoder, myEncoderParameters);

}

...

private ImageCodecInfo GetEncoder(ImageFormat format)
{
	ImageCodecInfo[] codecs = ImageCodecInfo.GetImageDecoders();

	foreach (ImageCodecInfo codec in codecs)
	{
	if (codec.FormatID == format.Guid)
	{
	return codec;
	}
	}
	return null;
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2009/11/saving-high-quality-jpg-in-c-or-aspnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Check if image (url) exists in ASP.NET</title>
		<link>http://tech.avivo.si/2009/08/check-if-image-url-exists-in-aspnet/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=check-if-image-url-exists-in-aspnet</link>
		<comments>http://tech.avivo.si/2009/08/check-if-image-url-exists-in-aspnet/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 10:07:40 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[check file on remote server]]></category>
		<category><![CDATA[check if image exists]]></category>
		<category><![CDATA[check url]]></category>

		<guid isPermaLink="false">http://blog.sweetucan.com/?p=158</guid>
		<description><![CDATA[HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("url"); request.Method = "HEAD"; bool exists; try {     request.GetResponse();     exists = true; } catch {    exists = false; }]]></description>
			<content:encoded><![CDATA[<pre class="prettyprint"><code><span class="typ">HttpWebRequest</span><span class="pln"> request </span><span class="pun">=</span><span class="pln"> </span><span class="pun">(</span><span class="typ">HttpWebRequest</span><span class="pun">)</span><span class="typ">HttpWebRequest</span><span class="pun">.</span><span class="typ">Create</span><span class="pun">(</span><span class="str">"url"</span><span class="pun">);</span><span class="pln">
request</span><span class="pun">.</span><span class="typ">Method</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="str">"HEAD"</span><span class="pun">;</span><span class="pln">

</span><span class="kwd">bool</span><span class="pln"> exists</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">try</span><span class="pln">
</span><span class="pun">{</span><span class="pln">
    request</span><span class="pun">.</span><span class="typ">GetResponse</span><span class="pun">();</span><span class="pln">
    exists </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">;</span><span class="pln">
</span><span class="pun">}</span><span class="pln">
</span><span class="kwd">catch</span><span class="pln">
</span><span class="pun">{</span><span class="pln">
   exists </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">;</span><span class="pln">
</span><span class="pun">}</span><span class="pln">
</span></code></pre>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2009/08/check-if-image-url-exists-in-aspnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 0</title>
		<link>http://tech.avivo.si/2009/06/syswebformspagerequestmanagerservererrorexception-an-unknown-error-occurred-while-processing-the-request-on-the-server-the-status-code-returned-from-the-server-was-0/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=syswebformspagerequestmanagerservererrorexception-an-unknown-error-occurred-while-processing-the-request-on-the-server-the-status-code-returned-from-the-server-was-0</link>
		<comments>http://tech.avivo.si/2009/06/syswebformspagerequestmanagerservererrorexception-an-unknown-error-occurred-while-processing-the-request-on-the-server-the-status-code-returned-from-the-server-was-0/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 18:48:24 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[ajax error]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[PageRequestManagerServerErrorException]]></category>

		<guid isPermaLink="false">http://blog.sweetucan.com/?p=87</guid>
		<description><![CDATA[If you get an error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 0 just add this code in HEAD section of your page/masterpage: &#60;script language="javascript" type="text/javascript"&#62; Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequest); function endRequest(sender, args) { // Check to see if there's an error on this request. [...]]]></description>
			<content:encoded><![CDATA[<p>If you get an error:</p>
<p><strong>Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 0</strong></p>
<p>just add this code in <strong>HEAD </strong>section of your page/masterpage:</p>
<pre>&lt;script language="javascript" type="text/javascript"&gt;
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequest);
function endRequest(sender, args)
{
	// Check to see if there's an error on this request.
	if (args.get_error() != undefined)
	{
	  //$get('Error').style.visibility = "visible";
	  // Let the framework know that the error is handled,
	  // so it doesn't throw the JavaScript alert.
	  args.set_errorHandled(true);
	}
}
&lt;/script&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2009/06/syswebformspagerequestmanagerservererrorexception-an-unknown-error-occurred-while-processing-the-request-on-the-server-the-status-code-returned-from-the-server-was-0/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Storing and retrieving images in MS SQL Server</title>
		<link>http://tech.avivo.si/2009/04/storing-and-retrieving-images-in-ms-sql-server/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=storing-and-retrieving-images-in-ms-sql-server</link>
		<comments>http://tech.avivo.si/2009/04/storing-and-retrieving-images-in-ms-sql-server/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 08:22:32 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[blob]]></category>
		<category><![CDATA[bytes array]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[ms sql server]]></category>
		<category><![CDATA[Storing and retrieving images in MS SQL Server]]></category>
		<category><![CDATA[uploading images]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://blog.sweetucan.com/?p=67</guid>
		<description><![CDATA[This is a tutorial from very nice Blog: Hi, I saw many developers are asking this questions in different forums. Recently I saw this question on MSDN forum and I thought let me write a blog on this. I know many of us found this too easy however for new bees its bit hard. In [...]]]></description>
			<content:encoded><![CDATA[<p>This is a tutorial from <a href="http://chiragrdarji.wordpress.com/2007/03/05/storing-and-retrieving-image-in-sql-server/" target="_blank">very nice Blog</a>:</p>
<p>Hi, I saw many developers are asking this questions in different forums. Recently I saw this question on MSDN forum and I thought let me write a blog on this. I know many of us found this too easy however for new bees its bit hard.</p>
<p>In this article, I had used SQL Server 2005 as back end and C# as front end. SQL Server has &#8220;Image&#8221; data type to store the image. In Oracle and some other database you can use a data type which is used to store binary value (may be BLOB). I have created a simple aspx which has File upload control and a button. When user selects a file to upload, I am checking it for valid image type and converting it to array of Bytes. Then I will store that byte array into database. Below is the code,<br />
<code><br />
if (objFileUpload.PostedFile !=null)<br />
{<br />
if (objFileUpload.PostedFile.ContentLength &gt; 0)<br />
{<br />
HttpPostedFile objHttpPostedFile = objFileUpload.PostedFile;<br />
if (CheckValidFileType(objHttpPostedFile.FileName))<br />
{<br />
int intContentlength = objHttpPostedFile.ContentLength;<br />
byte[] bytImage =new Byte[intContentlength];<br />
objHttpPostedFile.InputStream.Read(bytImage, 0, intContentlength);<br />
}<br />
}<br />
}<br />
</code><br />
Read Uploaded file (here Image) in Byte Array</p>
<p>Pass this Byte array to you DAL and use it for storing image in database. I am using Enterprise Library as DAL so my code will look like,<br />
<code><br />
Database db =DatabaseFactory.CreateDatabase();<br />
string sqlCommand ="StoredProcedureName";<br />
DbCommand dbCommandWrapper = db.GetStoredProcCommand(sqlCommand);<br />
db.AddInParameter(dbCommandWrapper,"@Image",DbType.Binary,bytImage );<br />
try<br />
{<br />
db.ExecuteNonQuery(dbCommandWrapper);<br />
}<br />
catch {throw; }<br />
</code><br />
Insert Image in to database</p>
<p>This is how you can store the Image in database. Retrieving the image is the same process. Write a SP which will return your image. Store this value in a Byte Array. Once you get the image in Byte array, you just have to write it on form as shown below,<br />
<code><br />
Byte[] bytImage =Byte array retrieved from database.<br />
if (bytImage !=null)<br />
{<br />
Response.ContentType = "image/jpeg";<br />
Response.Expires = 0;<br />
Response.Buffer =true;<br />
Response.Clear();<br />
Response.BinaryWrite(bytImage);<br />
Response.End();<br />
}<br />
</code></p>
<p>Code to display Byte array as Image on form.</p>
<p>To use this at multiple places in your application, you create a page to which you can pass ID of Image and it will retrieve image from database and create image. To do this copy paste above code in aspx.cs file. Now on every page you require to show this image  take  on that page and set its ImageURL property to the path of newly created user control. See the code below,</p>
<p>Image control on any aspx page (Lets say Sample.aspx).<br />
<code><br />
string strURL ="~/ViewImage.aspx?ID= 1";<br />
ViewImage.ImageUrl = strURL;<br />
</code><br />
set Image URL for image control on code behind (Sample.aspx.cs)</p>
<p>You can see the image will be displayed in your page where you had put Image tag.<br />
Happy Programing.</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2009/04/storing-and-retrieving-images-in-ms-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight 2 Plugin not working</title>
		<link>http://tech.avivo.si/2009/02/silverlight-2-plugin-not-working/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=silverlight-2-plugin-not-working</link>
		<comments>http://tech.avivo.si/2009/02/silverlight-2-plugin-not-working/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 20:43:26 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[Silverlight/WPF]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[beta]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[silverlight]]></category>
		<category><![CDATA[silverlight 2]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://blog.sweetucan.com/?p=26</guid>
		<description><![CDATA[Well, maybe you will expirience a problem that Silverlight 2 plugin is not working eventhough you have the latest version 2.0.30825.0 It is showing MIME type: application/x-silverlight-2-b2 This can be if you have old Silverlight 2 Beta version 2.0.10125.0 in bin directory of your website/application. Just ovewrite it with latest version and it will be [...]]]></description>
			<content:encoded><![CDATA[<p>Well, maybe you will expirience a problem that Silverlight 2 plugin is not working eventhough you have the latest version <strong>2.0.30825.0</strong></p>
<p>It is showing MIME type: <strong>application/x-silverlight-2-b2</strong></p>
<p>This can be if you have old Silverlight 2 Beta version <strong>2.0.10125.0</strong> in bin directory of your website/application.</p>
<p>Just ovewrite it with latest version and it will be ok.</p>
<p>Magic!</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2009/02/silverlight-2-plugin-not-working/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

