<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-17966682</id><updated>2012-02-16T18:51:27.279-08:00</updated><category term='C#'/><category term='TCP'/><category term='Visual Studio 2010'/><category term='ASP.NET'/><category term='.NET'/><title type='text'>Cogito Software development</title><subtitle type='html'>About software development, web development, software trics, C# and .NET.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://cogitosoft.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17966682/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://cogitosoft.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Vladimir</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>6</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-17966682.post-7414464905701372290</id><published>2009-06-15T06:44:00.000-07:00</published><updated>2009-08-03T23:40:40.302-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2010'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'></title><content type='html'>&lt;h1&gt;CodeFile and Codebehind&lt;/h1&gt;&lt;br /&gt;&lt;p&gt;I have the site that builds and runs perfectly on my development machine. It was created in Visual Studio 2008 and then ported to Visual Studio 2010, .NET 4.0. However, when I deploy it to the IIS, I got the very strange error message: &lt;i&gt;Could not find Default.aspx&lt;/i&gt;.&lt;/p&gt; &lt;br /&gt;&lt;p&gt;Then I started investigation and found that the original error message was &lt;b&gt;Parser Error Message: The file 'Default.aspx.cs' does not exist&lt;/b&gt;. The resolution for the problem is very simpple: just change the &lt;b&gt;&lt;span class="Apple-style-span"  style="color:#000066;"&gt;CodeFile&lt;/span&gt;&lt;/b&gt; to &lt;b&gt;&lt;span class="Apple-style-span"  style="color:#000066;"&gt;Codebehind&lt;/span&gt;&lt;/b&gt; in &lt;i&gt;Default.aspx&lt;/i&gt; and republish the site.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;http://www.landvp.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17966682-7414464905701372290?l=cogitosoft.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cogitosoft.blogspot.com/feeds/7414464905701372290/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17966682&amp;postID=7414464905701372290' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17966682/posts/default/7414464905701372290'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17966682/posts/default/7414464905701372290'/><link rel='alternate' type='text/html' href='http://cogitosoft.blogspot.com/2009/06/i-have-site-that-builds-and-runs.html' title=''/><author><name>Vladimir</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17966682.post-115860259897834036</id><published>2006-09-18T10:56:00.000-07:00</published><updated>2009-07-01T07:09:12.445-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'></title><content type='html'>&lt;span style="color: rgb(51, 0, 153); font-weight: bold;"&gt;How to display an image without creating a file? ( ASP.NET , C# )&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;PageWithImage.aspx.cs :&lt;span style="font-size:100%;"&gt;&lt;pre&gt;   &lt;span class="kw"&gt;public class&lt;/span&gt; PageWithImage : Page&lt;br /&gt;{&lt;br /&gt;   &lt;span class="kw"&gt;private void&lt;/span&gt; Page_Load(&lt;span class="kw"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;   {&lt;br /&gt;      using(Bitmap bmp = &lt;span class="kw"&gt;new&lt;/span&gt; Bitmap( blankW, blankH ))&lt;br /&gt;      using(Graphics g = Graphics.FromImage( bmp ))&lt;br /&gt;{&lt;br /&gt;       g.FillRectangle( ... );&lt;br /&gt;       g.DrawString( ... );&lt;br /&gt;       g.DrawLine( ... );&lt;br /&gt;&lt;br /&gt;       Response.ContentType = &lt;span class="str"&gt;"image/gif"&lt;/span&gt;;&lt;br /&gt;       bmp.Save( Response.OutputStream, ImageFormat.Gif );&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;   }&lt;br /&gt;     ...&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;a href="http://landvp.com"&gt;LandVP LLC&lt;/a&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;http://www.landvp.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17966682-115860259897834036?l=cogitosoft.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cogitosoft.blogspot.com/feeds/115860259897834036/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17966682&amp;postID=115860259897834036' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17966682/posts/default/115860259897834036'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17966682/posts/default/115860259897834036'/><link rel='alternate' type='text/html' href='http://cogitosoft.blogspot.com/2006/09/how-to-display-image-without-creating.html' title=''/><author><name>Vladimir</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17966682.post-115824144068844148</id><published>2006-09-14T06:39:00.000-07:00</published><updated>2009-07-01T07:08:50.268-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'></title><content type='html'>&lt;span style="font-weight: bold; color: rgb(51, 0, 153);"&gt;A couple of tips about IDisposable (C# .NET)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;p class="MsoNormal"&gt;&lt;span style="" lang="EN-US"&gt;There are tips that connected to using the disposable pattern and finalization code. Probably it should be included in our code standard document or people should pay attention to it.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="" lang="EN-US"&gt;Managed types must occasionally encapsulate control over resources that are not managed by the CLR. In such cases, the smallest possible class, or “wrapper”, should be used to encapsulate these resources. Ideally, this thin wrapper should contain just allocation along with provisions for basic access to and freeing of the resources. This small class should provide a destructor (~T()) and implement explicit Dispose method to enable users to free resources owned by an instance deterministically.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="" lang="EN-US"&gt;Implicit cleanup should always be provided by protecting resources with a SafeHandle. Implementing finalizers by hand is seldom necessary because of this type in the .NET Framework 2.0. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="" lang="EN-US"&gt;In every case where a type owns resources or it owns types which themselves own resources you should give users the ability to explicitly release them. Developers will then have the oprion to initiate the release of resources once the object is no longer n use. Explicit control should always be provided with a Dispose method based on the IDisposable interface.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="" lang="EN-US"&gt;Sealed classes that own unmanaged resources without wrappers:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;ul&gt;&lt;li&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="" lang="EN-US"&gt;&lt;span style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style="" lang="EN-US"&gt;Implement a finalizer (~T());&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="" lang="EN-US"&gt;&lt;span style=""&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="" lang="EN-US"&gt;Implement IDisposable with a simple method Dispose();&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;      &lt;p class="MsoNormal"&gt;&lt;span style="" lang="EN-US"&gt;Sealed classes that own wrapped resources:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;ul&gt;&lt;li&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="" lang="EN-US"&gt;&lt;span style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style="" lang="EN-US"&gt;Implement IDisposable with a simple method Dispose();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="" lang="EN-US"&gt;&lt;o:p&gt;&lt;/o:p&gt;Not sealed classes that own unmanaged resources without wrappers have to implement complete Disposable pattern (i.e. implement a finalizer ~T(), implement IDisposable interface (Dispose() method, it has to be final (not virtual) method), implement protected virtual void Dispose(bool) method).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="" lang="EN-US"&gt;&lt;o:p&gt;&lt;/o:p&gt;Not sealed classes that own wrapped resources don’t have to implement finalizers (just implement IDisposable interface with final Dispose() method) and implement protected virtual void Dispose(bool) method for cleaning the resources.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="" lang="EN-US"&gt;Do fully implement the dispose pattern on classes with disposable subtypes, even if the base type does not own resources. This will enable programmers coding against the base class to dispose of further derived instances properly.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="" lang="EN-US"&gt;Do not re-implement IDisposable interface, override void Dispose(), or override Finalize if a base class in your class hierarchy has already defined them according to this pattern. Just override virtual void Dispose(bool) function.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="" lang="EN-US"&gt;Do not create any other variations of the Dispose methods other than the two specified here: void Dispose() and virtual void Dispose(bool disposing). Dispose should be considered a reserved word in our code standard and used only in context of this pattern to avoid misunderstanding.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="" lang="EN-US"&gt;Do implement IDisposable pattern on every type that have finalizers (~T()). This gives users of your type a possibility to explicitly clean up resources.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="" lang="EN-US"&gt;Do allow your Dispose method to be called more than once. It should not generate an exception.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="" lang="EN-US"&gt;Set to null large managed object fields in your Dispose method.&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;a href="http://landvp.com"&gt;LandVP LLC&lt;/a&gt;&lt;br /&gt;&lt;span style="" lang="EN-US"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;http://www.landvp.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17966682-115824144068844148?l=cogitosoft.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cogitosoft.blogspot.com/feeds/115824144068844148/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17966682&amp;postID=115824144068844148' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17966682/posts/default/115824144068844148'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17966682/posts/default/115824144068844148'/><link rel='alternate' type='text/html' href='http://cogitosoft.blogspot.com/2006/09/couple-of-tips-about-idisposable-c.html' title=''/><author><name>Vladimir</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17966682.post-115817574847633416</id><published>2006-09-13T12:17:00.000-07:00</published><updated>2009-07-01T07:07:32.787-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'></title><content type='html'>&lt;span style="color: rgb(0, 0, 153); font-weight: bold;font-size:130%;" &gt;IDisposable and finalization code in C# .NET&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;There is a plenty of errors with finalization and Disposable pattern in code that new C# developers write, that’s why I decided to write about.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;When we need to implement a finalizer (destructor)?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The finalization code is incredibly useful when we need to release unmanaged resources. But the problem is that we have no guarantee when the finalization code is called. And because it is not public method the user could not call it explicitly. That is the reason why we need to implement the Disposable pattern. Classes, that don’t need to release unmanaged resources, should not implement a finalizer and IDisposable.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What is the Disposable pattern and when we need to use it?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We need to implement the Disposable pattern only in case when we need to add a finalization code.&lt;br /&gt;&lt;br /&gt;The sample of implementation of the Disposable pattern:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;  class SomeClass : IDisposable&lt;br /&gt;  {&lt;br /&gt;   &lt;span style="color: rgb(0, 102, 0);"&gt;// Track whether Dispose has been called.&lt;/span&gt;&lt;br /&gt;          bool _disposed = false;&lt;br /&gt;   object _syncObject = new object();&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;            ///&lt;sumary&gt;&lt;/sumary&gt;&lt;/span&gt;&lt;summary style="color: rgb(0, 102, 0);"&gt;&lt;br /&gt;          /// When garbage collected, this Finalize method, which&lt;br /&gt;          /// will close the unmanaged resource’s handle, is called.&lt;br /&gt;          ///&lt;/summary&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;/span&gt;&lt;br /&gt;           ~SomeClass()&lt;br /&gt;          {&lt;br /&gt;                  Dispose(false);&lt;br /&gt;          }&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;            ///&lt;sumary&gt;&lt;/sumary&gt;&lt;/span&gt;&lt;summary style="color: rgb(0, 102, 0);"&gt;&lt;br /&gt;          /// Implement IDisposable.&lt;br /&gt;          /// Do not make this method virtual.&lt;br /&gt;   /// A derived class should not be able to override this method.&lt;br /&gt;          ///&lt;/summary&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;/span&gt;&lt;br /&gt;           public void Dispose()&lt;br /&gt;          {&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;                    // Take yourself off the Finalization queue&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;                    // to prevent finalization code for this object&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;                    // from executing a second time.&lt;/span&gt;&lt;br /&gt;                   GC.SuppressFinalize(this);&lt;br /&gt;                  Dispose(true);&lt;br /&gt;          }&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;            ///&lt;sumary&gt;&lt;/sumary&gt;&lt;/span&gt;&lt;summary style="color: rgb(0, 102, 0);"&gt;&lt;br /&gt;          /// Dispose(bool disposing) executes in two distinct scenarios.&lt;br /&gt;          /// If disposing equals true, the method has been called directly&lt;br /&gt;          /// or indirectly by a user's code. Managed and unmanaged resources&lt;br /&gt;          /// can be disposed.&lt;br /&gt;          /// If disposing equals false, the method has been called by the&lt;br /&gt;          /// runtime from inside the finalizer and you should not reference&lt;br /&gt;          /// other objects. Only unmanaged resources can be disposed.&lt;br /&gt;          ///&lt;/summary&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;/span&gt;&lt;br /&gt;           protected virtual void Dispose(bool disposing)&lt;br /&gt;          {&lt;br /&gt;                  lock(_syncObject)&lt;br /&gt;                  {&lt;br /&gt;                          if (_disposed)&lt;br /&gt;                                  return;&lt;br /&gt;                          if (disposing)&lt;br /&gt;                          {&lt;br /&gt;                   &lt;span style="color: rgb(0, 102, 0);"&gt;               // The object is being explicitly disposed of/closed, not&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;                                    // finalized. It is therefore safe for code in this if&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;                                    // statement to access fields that reference other&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;                                    // objects because the Finalize method of these other objects&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;                                    // hasn’t yet been called.&lt;/span&gt;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;                          _disposed = true;&lt;br /&gt;       }&lt;br /&gt;          }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How to use the objects that implements IDisposable interface:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;When you create this kind of object you need to call IDisposable.Dispose() explicitly or implicitly (using statement).&lt;br /&gt;&lt;br /&gt;The example of explicit using Dispose:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;          SomeClass someClassObject = new SomeClass();&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;            // do something with someClassObject&lt;/span&gt;&lt;br /&gt;           someClassObject.Dispose();&lt;br /&gt;&lt;br /&gt;          SomeClass yetAnotherObject = new SomeClass();&lt;br /&gt;          try&lt;br /&gt;          {&lt;br /&gt;   &lt;span style="color: rgb(0, 102, 0);"&gt;// do something with yetAnotherObject&lt;/span&gt;&lt;br /&gt;          }&lt;br /&gt;          finally&lt;br /&gt;          {&lt;br /&gt;   yetAnotherObject.Dispose();&lt;br /&gt;          }&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;The Dispose should be called to release resources.&lt;br /&gt;&lt;br /&gt;The example of implicit using Dispose:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;          using(SomeClass someClassObject = new SomeClass())&lt;br /&gt;          {&lt;br /&gt;   &lt;span style="color: rgb(0, 102, 0);"&gt;// do something with someClassObject&lt;/span&gt;&lt;br /&gt;          }&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;In this case Dispose() is called by using statement when we go out of using block.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://landvp.com"&gt;LandVP LLC&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;http://www.landvp.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17966682-115817574847633416?l=cogitosoft.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cogitosoft.blogspot.com/feeds/115817574847633416/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17966682&amp;postID=115817574847633416' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17966682/posts/default/115817574847633416'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17966682/posts/default/115817574847633416'/><link rel='alternate' type='text/html' href='http://cogitosoft.blogspot.com/2006/09/idisposable-and-finalization-code-in-c.html' title=''/><author><name>Vladimir</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17966682.post-115498264692386799</id><published>2006-08-07T13:13:00.000-07:00</published><updated>2009-07-01T07:08:20.677-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'></title><content type='html'>&lt;h3&gt;How to send a mail from the ASP.NET web form.&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;In .NET 2.0 we have SmtpClient class that allows applications to send e-mail by using the Simple Mail Transfer Protocol (SMTP). &lt;br /&gt;Namespace: System.Net.Mail&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Example&lt;/b&gt;&lt;br /&gt;&lt;blockquote&gt;    protected void BtnSubmit_Click(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        if(!validateFields())&lt;br /&gt;            return;&lt;br /&gt;&lt;br /&gt;        &lt;br /&gt;        SmtpClient smtpClient = new SmtpClient(host, port);&lt;br /&gt;        smtpClient.Credentials = new NetworkCredential(user, password); &lt;br /&gt;        &lt;br /&gt;        MailAddress from = new MailAddress(EmailBox.Text, NameBox.Text);&lt;br /&gt;        MailAddress to = new MailAddress(to_mail);&lt;br /&gt;&lt;br /&gt;        MailMessage message = new MailMessage(from, to);&lt;br /&gt;        message.Subject = string.Format(subject_template, NameBox.Text, PhoneBox.Text);&lt;br /&gt;        message.Body = QuestionBox.Text;&lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;            smtpClient.Send(message);&lt;br /&gt;            Response.Redirect(redirect_success,true);&lt;br /&gt;        }&lt;br /&gt;        catch(Exception ex)&lt;br /&gt;        {&lt;br /&gt;            ErrorMessage = ex.Message;&lt;br /&gt;            Response.Redirect(redirect_error, true);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;a href="http://landvp.com"&gt;LandVP LLC&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;http://www.landvp.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17966682-115498264692386799?l=cogitosoft.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cogitosoft.blogspot.com/feeds/115498264692386799/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17966682&amp;postID=115498264692386799' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17966682/posts/default/115498264692386799'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17966682/posts/default/115498264692386799'/><link rel='alternate' type='text/html' href='http://cogitosoft.blogspot.com/2006/08/how-to-send-mail-from-asp.html' title=''/><author><name>Vladimir</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17966682.post-113398791648540311</id><published>2005-12-07T12:38:00.000-08:00</published><updated>2009-07-01T07:10:11.802-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TCP'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'></title><content type='html'>&lt;strong&gt;Programmatic Channel Registration&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;A remoting channel is any component that implements the IChannel interface. Both the client and the host application need to register which channels they wish to use, using the static method RegisterChannel of the ChannelServices class.&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;Host channels registration&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The host must register at least one channel if it wants to export objects.&lt;br /&gt;&lt;br /&gt;// Register TCP channel&lt;br /&gt;IChannel channel = new TcpChannel(8005);&lt;br /&gt;ChannelServices.RegisterChannel(channel);&lt;br /&gt;&lt;br /&gt;// Register HTTP channel&lt;br /&gt;IChannel channel = new HttpChannel(8006);&lt;br /&gt;ChannelServices.RegisterChannel(channel);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://landvp.com"&gt;LandVP LLC&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;http://www.landvp.com&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17966682-113398791648540311?l=cogitosoft.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cogitosoft.blogspot.com/feeds/113398791648540311/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17966682&amp;postID=113398791648540311' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17966682/posts/default/113398791648540311'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17966682/posts/default/113398791648540311'/><link rel='alternate' type='text/html' href='http://cogitosoft.blogspot.com/2005/12/programmatic-channel-registration.html' title=''/><author><name>Vladimir</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
