<?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>Coskun SUNALI &#124; .net framework, c#, asp.net, atlas, visual studio, iis and everything else &#187; asp.net</title>
	<atom:link href="http://sunali.com/tag/aspnet/feed/" rel="self" type="application/rss+xml" />
	<link>http://sunali.com</link>
	<description>Coşkun SUNALI</description>
	<lastBuildDate>Mon, 22 Nov 2010 13:42:45 +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>Beginners&#8217; guide for ASP.NET 4.0</title>
		<link>http://sunali.com/2010/09/27/beginners-guide-for-asp-net-4-0/</link>
		<comments>http://sunali.com/2010/09/27/beginners-guide-for-asp-net-4-0/#comments</comments>
		<pubDate>Mon, 27 Sep 2010 07:52:28 +0000</pubDate>
		<dc:creator>Coskun SUNALI</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[asp.net]]></category>

		<guid isPermaLink="false">http://sunali.com/?p=449</guid>
		<description><![CDATA[Just came across to a nice article explaining what is ASP.NET and what it is not. It is worth to read for complete beginners. http://www.code-magazine.com/Article.aspx?quickid=100163]]></description>
			<content:encoded><![CDATA[<p>Just came across to a nice article explaining what is ASP.NET and what it is not. It is worth to read for complete beginners.</p>
<p><a href="http://www.code-magazine.com/Article.aspx?quickid=100163" target="_blank">http://www.code-magazine.com/Article.aspx?quickid=100163</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sunali.com/2010/09/27/beginners-guide-for-asp-net-4-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Microsoft Days 2010 Bulgaria &#8211; Extensible Output Caching with ASP.NET 4 Session</title>
		<link>http://sunali.com/2010/02/08/microsoft-days-2010-bulgaria-extensible-output-caching-with-asp-net-4-session/</link>
		<comments>http://sunali.com/2010/02/08/microsoft-days-2010-bulgaria-extensible-output-caching-with-asp-net-4-session/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 14:26:39 +0000</pubDate>
		<dc:creator>Coskun SUNALI</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[announcement]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[speaking engagement]]></category>

		<guid isPermaLink="false">http://sunali.com/2010/02/08/microsoft-days-2010-bulgaria-extensible-output-caching-with-asp-net-4-session/</guid>
		<description><![CDATA[Microsoft Days 2010 Bulgaria will take place in Sofia on 30-31 March 2010. The conference consists of numerous valuable lecturers and the whole list can be seen at http://www.msbgregistration.com/Lecturers.aspx. I will be presenting a session titled as Extensible Output Caching with ASP.NET 4. Here is a brief description of my session: Through ASP.NET 1 to [...]]]></description>
			<content:encoded><![CDATA[<p>Microsoft Days 2010 Bulgaria will take place in Sofia on 30-31 March 2010. The conference consists of numerous valuable lecturers and the whole list can be seen at <a title="http://www.msbgregistration.com/Lecturers.aspx" href="http://www.msbgregistration.com/Lecturers.aspx" target="_blank">http://www.msbgregistration.com/Lecturers.aspx</a>.</p>
<p>I will be presenting a session titled as <strong>Extensible Output Caching with ASP.NET 4</strong>.</p>
<p>Here is a brief description of my session:</p>
<blockquote><p>Through ASP.NET 1 to 3.5, output caching was stuck in memory. ASP.NET 4 makes it possible to use custom output-cache providers to use any kind of storage mechanism including databases, local and remove disks and distributed cache engines. In this session, we will build a custom output-cache provider that persists data in local hard-drive and we will learn how to configure an ASP.NET application to use some famous distributed cache engines. This is a coding and configuring oriented session.</p>
</blockquote>
<p><a href="http://kulov.net" target="_blank">Martin Kulov</a> is of course there with 2 sessions. One about <strong>Visual Studio Test Professional 2010</strong> and one about <strong>Branching and Merging with TFS 2010</strong>. </p>
<p>Another cool news is that <a href="http://daron.yondem.com" target="_blank">Daron Yondem</a> from Turkey will also be there with 2 <strong>Silverlight</strong> sessions.</p>
<p>Those of you living in Bulgaria or who can visit Bulgaria for the event, do not forget to register at <a href="http://www.msbgregistration.com" target="_blank">http://www.msbgregistration.com</a> before all the seats are booked.</p>
]]></content:encoded>
			<wfw:commentRss>http://sunali.com/2010/02/08/microsoft-days-2010-bulgaria-extensible-output-caching-with-asp-net-4-session/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The resource object with key &#8230; was not found</title>
		<link>http://sunali.com/2009/10/01/the-resource-object-with-key-was-not-found/</link>
		<comments>http://sunali.com/2009/10/01/the-resource-object-with-key-was-not-found/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 14:32:26 +0000</pubDate>
		<dc:creator>Coskun SUNALI</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[know how]]></category>
		<category><![CDATA[localization]]></category>
		<category><![CDATA[resource files]]></category>

		<guid isPermaLink="false">http://sunali.com/?p=418</guid>
		<description><![CDATA[If you ever face problems with your resources and somehow the ASP.NET application/website refuses to load them, consider checking if your website path is readable by the process owner user of the website application pool.]]></description>
			<content:encoded><![CDATA[<p>If you ever face problems with your resources and somehow the ASP.NET application/website refuses to load them, consider checking if your website path is readable by the process owner user of the website application pool.</p>
]]></content:encoded>
			<wfw:commentRss>http://sunali.com/2009/10/01/the-resource-object-with-key-was-not-found/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Web Deployment with VS 2010 and IIS</title>
		<link>http://sunali.com/2009/02/04/web-deployment-with-vs-2010-and-iis/</link>
		<comments>http://sunali.com/2009/02/04/web-deployment-with-vs-2010-and-iis/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 11:15:53 +0000</pubDate>
		<dc:creator>Coskun SUNALI</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[iis]]></category>
		<category><![CDATA[vs 2010]]></category>

		<guid isPermaLink="false">http://sunali.com/?p=396</guid>
		<description><![CDATA[Visual Web Developer Team posted an interesting post on their blog today. It gives a short description of how web deployment scenarios will be handled in Visual Studio 2010. Of course including deployment of database, IIS settings and transformation of the Web.config file. Personally, I am really excited to see these features in VS 2010. [...]]]></description>
			<content:encoded><![CDATA[<p>Visual Web Developer Team posted an interesting post on their blog today. It gives a short description of how web deployment scenarios will be handled in Visual Studio 2010. Of course including deployment of database, IIS settings and transformation of the Web.config file.</p>
<p>Personally, I am really excited to see these features in VS 2010. It will definitely be better than FTP deployment because it will be able to handle a lot of scenarios like IIS settings, web.config changes depending on the environment (release, debug, staging, production, etc.), database changes, GAC, etc. If you want, you may go ahead and give it a try, it is a Beta 2 release though.</p>
<p>P.S.: Currently, only web application projects are supported. According to the team, they are considering to support web site projects and pre-compilation scenarios in the future.</p>
<p><a href="http://blogs.msdn.com/webdevtools/archive/2009/02/04/web-deployment-with-vs-2010-and-iis.aspx" target="_blank">You may read the complete post here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sunali.com/2009/02/04/web-deployment-with-vs-2010-and-iis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET MVC final version is on its way to be released soon, RC is already ready to be downloaded!</title>
		<link>http://sunali.com/2009/01/28/aspnet-mvc-final-version-is-on-its-way-to-be-released-soon-rc-is-already-ready-to-be-downloaded/</link>
		<comments>http://sunali.com/2009/01/28/aspnet-mvc-final-version-is-on-its-way-to-be-released-soon-rc-is-already-ready-to-be-downloaded/#comments</comments>
		<pubDate>Wed, 28 Jan 2009 17:09:56 +0000</pubDate>
		<dc:creator>Coskun SUNALI</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[announcement]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[mvc]]></category>

		<guid isPermaLink="false">http://sunali.com/?p=391</guid>
		<description><![CDATA[Most of us have been waiting for ASP.NET MVC to get to its final release so we can use it in our projects. The main reason to do that is because until it is in its Release Candidate version, its features are subject to change at anytime. However, that was until yesterday. Now its Release [...]]]></description>
			<content:encoded><![CDATA[<p>Most of us have been waiting for ASP.NET MVC to get to its final release so we can use it in our projects. The main reason to do that is because until it is in its Release Candidate version, its features are subject to change at anytime. However, that was until yesterday. Now its Release Candidate version is public and can be downloaded by <a href="http://go.microsoft.com/fwlink/?LinkID=141184&amp;clcid=0x409" target="_blank">clicking this link</a> and also you can see its release notes by <a href="http://go.microsoft.com/fwlink/?LinkID=137661&amp;clcid=0x409" target="_blank">clicking this link</a>.</p>
<p>Good news is that ASP.NET MVC&#8217;s final version will be released next month, in February 2009.</p>
<p>Some important changes might be listed as below.</p>
<ul>
<li>&#8220;Create Controller&#8221; action in Visual Studio context menu in Solution Explorer.</li>
<li>&#8220;Add View&#8221; action in Visual Studio context menu inside an Action method&#8217;s body. This will let you create an empty View or a View that has been specially created for the type that is being passed as a parameter to the View. E.g.: <strong>return View(user)</strong> will create a basic View that has &#8220;user&#8221; entity&#8217;s type&#8217;s properties.</li>
<li>Ability to customize any kind of templates being used by MVC using T4 (Text Template Transformation Toolkit) &#8211; <a href="http://www.hanselman.com/blog/T4TextTemplateTransformationToolkitCodeGenerationBestKeptVisualStudioSecret.aspx" target="_blank">further reading</a>. Both machine-wide and project-wide!</li>
<li>RC release now includes a out of the box MSBuild task so you can compile the views within your ASP.NET MVC project.</li>
<li>Views can work without Code-Behind files. You can still use the advantages of strongly typed base type. E.g.: <strong>Inherits=&#8221;System.Web.Mvc.ViewPage&lt;MyCustomType&gt;&#8221;</strong></li>
<li>To access the Model&#8217;s data, you don&#8217;t need to use &#8220;<strong>ViewData.Model</strong>&#8221; anymore. &#8220;<strong>Model</strong>&#8221; is a top-level property from now on. &#8220;ViewData.Model&#8221; still works though.</li>
<li>An out of the box MSBuild task is included in the setup if you want to compile the code within the views.</li>
<li>You are not required to use <strong>Bind</strong> attribute with <strong>Prefix</strong> value set to an empty string [<strong>Bind(Prefix="")</strong>] by the default behavior.</li>
<li>Supports protection to &#8220;<a href="http://en.wikipedia.org/wiki/Cross-site_request_forgery" target="_blank">Cross-site request forgery</a>&#8221; attacks with an out of the box attribute: <strong>ValidateAntiForgeryToken</strong>. You may apply this attribute to the actions that you want to protect.</li>
<li><strong>FileResult</strong> (an out of the box ActionResult) to response a file instead of some other views using an action. Also there is the new <strong>File()</strong> method to create and return a file.</li>
</ul>
<p>Visit <a href="http://www.asp.net/mvc" target="_blank">http://www.asp.net/mvc</a> for more details.</p>
]]></content:encoded>
			<wfw:commentRss>http://sunali.com/2009/01/28/aspnet-mvc-final-version-is-on-its-way-to-be-released-soon-rc-is-already-ready-to-be-downloaded/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HttpPostedFile.FileName browser dependent behaviour</title>
		<link>http://sunali.com/2008/12/14/httppostedfilefilename-browser-dependent-behaviour/</link>
		<comments>http://sunali.com/2008/12/14/httppostedfilefilename-browser-dependent-behaviour/#comments</comments>
		<pubDate>Sun, 14 Dec 2008 15:05:46 +0000</pubDate>
		<dc:creator>Coskun SUNALI</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[.net framework]]></category>
		<category><![CDATA[asp.net]]></category>

		<guid isPermaLink="false">http://sunali.com/?p=209</guid>
		<description><![CDATA[Even though these kind of variables must have some standards (may be it already has), there are differences in practise. Be careful with the FileName property of HttpPostedFile class when you want to work on a file being uploaded by visitors of your page because the FileName value that you will get on Internet Explorer [...]]]></description>
			<content:encoded><![CDATA[<p>Even though these kind of variables must have some standards (may be it already has), there are differences in practise. Be careful with the FileName property of HttpPostedFile class when you want to work on a file being uploaded by visitors of your page because the FileName value that you will get on Internet Explorer and Firefox are different.</p>
<p>If your visitor uses Internet Explorer, you will get the local path to the file. E.g.: C:\somefile.txt. However, if your visitor uses Firefox, the FileName value that you will get will be only the file&#8217;s name. E.g.: somefile.txt.</p>
<p>To avoid problems, you may have the following check.</p>
<p><code> </code></p>
<pre>string filename = postedFile.FileName;
if (filename.IndexOf('\\') &gt; -1)
{
    filename = filename.Substring(filename.LastIndexOf('\\') + 1);
}
else if (filename.IndexOf('/') &gt; -1)
{
    filename = filename.Substring(filename.LastIndexOf('/') + 1);
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://sunali.com/2008/12/14/httppostedfilefilename-browser-dependent-behaviour/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Extension methods don&#8217;t compile? No panic!</title>
		<link>http://sunali.com/2008/12/10/extension-methods-dont-compile-no-panic/</link>
		<comments>http://sunali.com/2008/12/10/extension-methods-dont-compile-no-panic/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 15:28:26 +0000</pubDate>
		<dc:creator>Coskun SUNALI</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[extension methods]]></category>

		<guid isPermaLink="false">http://sunali.com/?p=204</guid>
		<description><![CDATA[I came across to a really strange problem today. Some extension methods that I have copied from another project just did not want to be compiled at all. &#8216;string&#8217; does not contain a definition for &#8216;MethodName&#8217;. I have checked everything, including clearing the temporary ASP.NET files within framework folder (C:\Windows\Microsoft.NET\Framework\&#8230;), restarting Visual Studio and even [...]]]></description>
			<content:encoded><![CDATA[<p>I came across to a really strange problem today. Some extension methods that I have copied from another project just did not want to be compiled at all.</p>
<p><em>&#8216;string&#8217; does not contain a definition for &#8216;MethodName&#8217;.</em></p>
<p>I have checked everything, including clearing the temporary ASP.NET files within framework folder (<span style="color: #c0c0c0;">C:\Windows\Microsoft.NET\Framework\&#8230;</span>), restarting Visual Studio and even restarting the OS. The target framework of the projects were all set to 3.5 as well. But unfortunately, nothing helped. Finally, when I compared what kind of configuration I could be missing from web.config, I have found out the missing (and the killer) part.</p>
<p>If you have a similar problem, try adding the following configuration section in your project&#8217;s web.config file.</p>
<pre>  &lt;system.codedom&gt;
    &lt;compilers&gt;
      &lt;compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&gt;
        &lt;providerOption name="CompilerVersion" value="v3.5"/&gt;
        &lt;providerOption name="WarnAsError" value="false"/&gt;
      &lt;/compiler&gt;
    &lt;/compilers&gt;
  &lt;/system.codedom&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://sunali.com/2008/12/10/extension-methods-dont-compile-no-panic/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Some useful UpdatePanel extensions</title>
		<link>http://sunali.com/2008/12/05/some-useful-updatepanel-extensions/</link>
		<comments>http://sunali.com/2008/12/05/some-useful-updatepanel-extensions/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 16:09:21 +0000</pubDate>
		<dc:creator>Coskun SUNALI</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[code snippet]]></category>
		<category><![CDATA[extension methods]]></category>

		<guid isPermaLink="false">http://sunali.com/?p=233</guid>
		<description><![CDATA[I want to share some pretty basic and useful UpdatePanel control extensions with you. Method names are self explaining so I will not go deep in details. public static void AlertOnLoad(this UpdatePanel updatePanel, string key, string message) { message = message.Replace("'", "\'").Replace("\r\n", "").Replace("\n", ""); message = "alert('" + message + "');"; AjaxControlToolkit.ToolkitScriptManager.RegisterStartupScript(updatePanel, updatePanel.GetType(), key, message, [...]]]></description>
			<content:encoded><![CDATA[<p>I want to share some pretty basic and useful UpdatePanel control extensions with you. Method names are self explaining so I will not go deep in details.</p>
<pre>public static void AlertOnLoad(this UpdatePanel updatePanel, string key, string message)
{
    message = message.Replace("'", "\'").Replace("\r\n", "").Replace("\n", "");
    message = "alert('" + message + "');";
    AjaxControlToolkit.ToolkitScriptManager.RegisterStartupScript(updatePanel, updatePanel.GetType(), key, message, true);
}

public static void RedirectOnLoad(this UpdatePanel updatePanel, string key, string url)
{
    url = "top.location.href = '" + url + "';";
    AjaxControlToolkit.ToolkitScriptManager.RegisterStartupScript(updatePanel, updatePanel.GetType(), key, url, true);
}

public static void OpenWindowOnLoad(this UpdatePanel updatePanel, string key, string url)
{
    url = "window.open('" + url + "');";
    AjaxControlToolkit.ToolkitScriptManager.RegisterStartupScript(updatePanel, updatePanel.GetType(), key, url, true);
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://sunali.com/2008/12/05/some-useful-updatepanel-extensions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to generate RSS feeds without any 3rd party components</title>
		<link>http://sunali.com/2008/11/24/how-to-generate-rss-feeds-without-any-3rd-party-components/</link>
		<comments>http://sunali.com/2008/11/24/how-to-generate-rss-feeds-without-any-3rd-party-components/#comments</comments>
		<pubDate>Mon, 24 Nov 2008 17:53:46 +0000</pubDate>
		<dc:creator>Coskun SUNALI</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[code snippet]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://sunali.com/?p=215</guid>
		<description><![CDATA[RSS feeds are widely used in today&#8217;s internet world. Thus we, developers, have to implement it on our websites and projects most of the time. There are many free and paid components that generates RSS feeds but in fact you may generate it by yourself as well. I will post a generic handler&#8217;s source code [...]]]></description>
			<content:encoded><![CDATA[<p>RSS feeds are widely used in today&#8217;s internet world. Thus we, developers, have to implement it on our websites and projects most of the time. There are many free and paid components that generates RSS feeds but in fact you may generate it by yourself as well.</p>
<p>I will post a generic handler&#8217;s source code to show you how to do that.</p>
<p><strong>Post</strong> is a class that has some basic properties like Url, Title, Teaser, etc. You may need to write your own class and implement these properties in a basic manner. Then you will need to create a <strong>GetPosts()</strong> method that returns a list of Post objects.</p>
<p><span id="more-215"></span></p>
<p><code></p>
<pre>
&lt;%@ WebHandler Language="C#" Class="Rss" %&gt;

using System;
using System.Web;
using System.Text;
using System.Xml;
using System.Collections.Generic;
using System.Linq;

public class Rss : IHttpHandler {

    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/xml";
        context.Response.ContentEncoding = Encoding.UTF8;
        context.Response.Write("&lt;?xml version=\"1.0\" encoding=\"utf-8\" ?&gt;");

        XmlTextWriter xmlWriter = new XmlTextWriter(context.Response.Output);

        xmlWriter.WriteStartElement("rss");
        xmlWriter.WriteAttributeString("version", "2.0");
        xmlWriter.WriteAttributeString("xmlns:dc", "http://purl.org/dc/elements/1.1/");

        xmlWriter.WriteStartElement("channel");

        #region Channel Details

        xmlWriter.WriteStartElement("title");
        xmlWriter.WriteCData("Sunali.com");
        xmlWriter.WriteEndElement(); // end title

        xmlWriter.WriteStartElement("link");
        xmlWriter.WriteCData("http://sunali.com");
        xmlWriter.WriteEndElement(); // end link

        xmlWriter.WriteStartElement("description");
        xmlWriter.WriteCData("Sunali.com Posts RSS Feed");
        xmlWriter.WriteEndElement(); // end description

        xmlWriter.WriteStartElement("language");
        xmlWriter.WriteString("tr-TR");
        xmlWriter.WriteEndElement(); // end language

        xmlWriter.WriteStartElement("pubDate");
        xmlWriter.WriteString(DateTime.Now.ToString("ddd, dd MMM yyyy hh:mm:ss zz"));
        xmlWriter.WriteEndElement(); // end pubDate
        #endregion

        // You are supposed to write your GetPosts method by yourself.
        List&lt;Post&gt; posts = GetPosts();

        foreach (Post post in posts)
        {
            xmlWriter.WriteStartElement("item");

            xmlWriter.WriteStartElement("title");
            xmlWriter.WriteCData(post.Title);
            xmlWriter.WriteEndElement(); // end title

            xmlWriter.WriteStartElement("link");
            xmlWriter.WriteCData(post.Url);
            xmlWriter.WriteEndElement(); // end link

            xmlWriter.WriteStartElement("description");
            xmlWriter.WriteCData(post.Teaser);
            xmlWriter.WriteEndElement(); // end description

            xmlWriter.WriteStartElement("dc:creator");
            xmlWriter.WriteCData(post.AuthorName);
            xmlWriter.WriteEndElement(); // end dc:creator

            xmlWriter.WriteStartElement("pubDate");
            xmlWriter.WriteString(post.PublishDate.ToString("ddd, dd MMM yyyy hh:mm:ss zz"));
            xmlWriter.WriteEndElement(); // end pubDate

            xmlWriter.WriteStartElement("guid");
            xmlWriter.WriteAttributeString("isPermaLink", "false");
            xmlWriter.WriteCData(post.Url);
            xmlWriter.WriteEndElement(); // end guid

            xmlWriter.WriteEndElement(); // end item
        }

        xmlWriter.WriteEndElement(); // end channel
        xmlWriter.WriteEndElement(); // end rss
    }

    public bool IsReusable {
        get {
            return false;
        }
    }
}
</pre>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://sunali.com/2008/11/24/how-to-generate-rss-feeds-without-any-3rd-party-components/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Easiest way of global error handling in an ASP.NET application</title>
		<link>http://sunali.com/2008/11/20/easiest-way-of-global-error-handling-in-an-aspnet-application/</link>
		<comments>http://sunali.com/2008/11/20/easiest-way-of-global-error-handling-in-an-aspnet-application/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 16:44:19 +0000</pubDate>
		<dc:creator>Coskun SUNALI</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[code snippet]]></category>

		<guid isPermaLink="false">http://sunali.com/?p=225</guid>
		<description><![CDATA[Since there are different ways of global error handling in ASP.NET applications and you have to implement the one that best fits into your project&#8217;s architecture, I will not be discussing all the possibilities that ASP.NET provides you. However, I will just share a small code snippet that you can use to catch unhandled exceptions [...]]]></description>
			<content:encoded><![CDATA[<p>Since there are different ways of global error handling in ASP.NET applications and you have to implement the one that best fits into your project&#8217;s architecture, I will not be discussing all the possibilities that ASP.NET provides you. However, I will just share a small code snippet that you can use to catch unhandled exceptions and write a small piece of code to send you an email whenever an error occurs. Just put the following code in your project&#8217;s Global.asax file and it is supposed to work in case you have your SMTP server settings set correctly in the web.config file or you should modify the email sending part depending on your SMTP configuration. Hope it is going to be useful for you.</p>
<p><code></p>
<pre>
void Application_Error(object sender, EventArgs e)
{
    Exception ex = Server.GetLastError();

    if (ex != null)
    {
        if (ex.InnerException != null)
        {
            ex = ex.InnerException;
        }

        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        sb.AppendLine("EXCEPTION - BEGIN&lt;br/&gt;&lt;br/&gt;");
        sb.AppendFormat("URL: {0}&lt;br/&gt;", Request.Url);
        sb.AppendFormat("Time: {0}&lt;br/&gt;&lt;br/&gt;", DateTime.Now);
        sb.AppendLine("EXCEPTION DETAILS:&lt;br/&gt;&lt;br/&gt;");
        sb.Append(ex);
        sb.Append("&lt;br/&gt;&lt;br/&gt;EXCEPTION - END");
        sb.Replace("\n", "&lt;br/&gt;");

        try
        {
            System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient();
            System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();

            mail.To.Add("yourname@yourdomain.com");
            mail.Body = sb.ToString();
            mail.BodyEncoding = Encoding.UTF8;
            mail.IsBodyHtml = true;
            mail.Subject = "Exception occured at sunali.com";
            mail.SubjectEncoding = Encoding.UTF8;

            smtp.Send(mail);
        }
        catch { }
    }
}
</pre>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://sunali.com/2008/11/20/easiest-way-of-global-error-handling-in-an-aspnet-application/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

