<?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>dotnet thoughts &#187; Http Handler</title>
	<atom:link href="http://www.dotnetthoughts.net/tag/http-handler/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dotnetthoughts.net</link>
	<description>a dotnet developer&#039;s technical blog</description>
	<lastBuildDate>Thu, 02 Feb 2012 03:18:00 +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>Difference between HTTP Handlers and HTTP Modules</title>
		<link>http://www.dotnetthoughts.net/2010/08/02/difference-between-http-handlers-and-http-modules/</link>
		<comments>http://www.dotnetthoughts.net/2010/08/02/difference-between-http-handlers-and-http-modules/#comments</comments>
		<pubDate>Mon, 02 Aug 2010 13:05:52 +0000</pubDate>
		<dc:creator>Anuraj P</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[.Net 3.0 / 3.5]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[Http Handler]]></category>
		<category><![CDATA[Http Module]]></category>

		<guid isPermaLink="false">http://www.dotnetthoughts.net/?p=1022</guid>
		<description><![CDATA[HTTP modules differ from HTTP handlers. An HTTP handler returns a response to a request that is identified by a file name extension or family of file name extensions. In contrast, an HTTP module is invoked for all requests and &#8230; <a href="http://www.dotnetthoughts.net/2010/08/02/difference-between-http-handlers-and-http-modules/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>HTTP modules differ from HTTP handlers. An HTTP handler returns a response to a request that is identified by a file name extension or family of file name extensions. In contrast, an HTTP module is invoked for all requests and responses. It subscribes to event notifications in the request pipeline and lets you run code in registered event handlers. The tasks that a module is used for are general to an application and to all requests for resources in the application.</p>
<p>You can get more information on <a href="http://msdn.microsoft.com/en-us/library/bb398986.aspx" target="_blank">MSDN &#8211; HTTP Handlers and HTTP Modules Overview</a></p>
<div class="betterrelated"><p><strong>Related content:</strong></p>
<ol><li> <a href="http://www.dotnetthoughts.net/2010/01/05/http-compression-in-asp-net/" title="Permanent link to Http Compression in ASP.Net">Http Compression in ASP.Net</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2009/11/03/simple-url-rewriting-in-asp-net-with-csharp/" title="Permanent link to Simple URL Rewriting in ASP.Net with C#">Simple URL Rewriting in ASP.Net with C#</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2009/09/15/how-to-use-session-objects-in-an-httphandler/" title="Permanent link to How to use Session objects in an HttpHandler">How to use Session objects in an HttpHandler</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2010/03/30/using-custom-controls-from-app_code-folder/" title="Permanent link to Using custom controls from App_Code folder">Using custom controls from App_Code folder</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2010/11/26/how-to-upload-file-using-httpwebrequest-class/" title="Permanent link to How to upload file using HttpWebRequest class">How to upload file using HttpWebRequest class</a>  </li>
</ol></div>]]></content:encoded>
			<wfw:commentRss>http://www.dotnetthoughts.net/2010/08/02/difference-between-http-handlers-and-http-modules/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to use Session objects in an HttpHandler</title>
		<link>http://www.dotnetthoughts.net/2009/09/15/how-to-use-session-objects-in-an-httphandler/</link>
		<comments>http://www.dotnetthoughts.net/2009/09/15/how-to-use-session-objects-in-an-httphandler/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 07:24:53 +0000</pubDate>
		<dc:creator>Anuraj P</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[.Net 3.0 / 3.5]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[C#.Net]]></category>
		<category><![CDATA[Http Handler]]></category>
		<category><![CDATA[Session]]></category>

		<guid isPermaLink="false">http://anuraj.wordpress.com/?p=385</guid>
		<description><![CDATA[In my previous post, Captcha using ASP.Net and C#, you may noticed that I am not talking about how can I validate the user is entering correct value or not. I thought of using Sessions for this purpose, like in &#8230; <a href="http://www.dotnetthoughts.net/2009/09/15/how-to-use-session-objects-in-an-httphandler/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In my previous post, <a href="http://anuraj.wordpress.com/2009/09/15/captcha-using-asp-net-and-c/">Captcha using ASP.Net and C#</a>, you may noticed that I am not talking about how can I validate the user is entering correct value or not. I thought of using Sessions for this purpose, like in the HTTP Handler, I wrote some code like</p>
<pre class="brush: csharp; title: ; notranslate">
context.Session[&quot;captcha&quot;] = drawString;
</pre>
<p>But that code failed, by throwing a Null Reference exception. After debugging I found the session object is coming as NULL. Then after doing a little search I found a nice post about how can we use session state in Http Handlers. For this you have to implement an empty interface, IRequiresSessionState, which in the available in the System.Web.SessionState namespace, you have to add reference of this namespace in your code, implement the interface, and you can use session in the Http Handler.</p>
<pre class="brush: csharp; title: ; notranslate">
using System.Web.SessionState;

public class Handler : IHttpHandler, IRequiresSessionState
{
//Your implementation.
}
</pre>
<p>You can also use IReadOnlySessionState interface instead of IRequiresSessionState, which gives read only access to the session objects.</p>
<p>Now you can save the drawString value to the session state and in the C# code, you can read it from session and check with the user entry.</p>
<p>You can get more details from this post :<a href="http://weblogs.asp.net/ashicmahtab/archive/2008/09/18/how-to-use-session-values-in-an-httphandler.aspx" target="_blank">How to use Session values in an HttpHandler</a></p>
<div class="betterrelated"><p><strong>Related content:</strong></p>
<ol><li> <a href="http://www.dotnetthoughts.net/2009/09/15/captcha-using-asp-net-and-c/" title="Permanent link to Captcha using ASP.Net and C#">Captcha using ASP.Net and C#</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2009/09/15/creating-captcha-html-helper/" title="Permanent link to Creating Captcha HTML Helper">Creating Captcha HTML Helper</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2009/10/07/how-to-store-and-retrieve-files-from-sql-server-database/" title="Permanent link to How to Store and Retrieve files from SQL Server Database">How to Store and Retrieve files from SQL Server Database</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2009/07/30/implementing-windows-authentication-in-asp-net-on-iis-7/" title="Permanent link to Implementing Windows authentication in ASP.NET on IIS 7">Implementing Windows authentication in ASP.NET on IIS 7</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2009/10/22/implementing-custom-paging-in-datarepeater-using-c-and-sql-server/" title="Permanent link to Implementing Custom Paging in DataRepeater using C# and SQL Server">Implementing Custom Paging in DataRepeater using C# and SQL Server</a>  </li>
</ol></div>]]></content:encoded>
			<wfw:commentRss>http://www.dotnetthoughts.net/2009/09/15/how-to-use-session-objects-in-an-httphandler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

