<?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:blogger='http://schemas.google.com/blogger/2008' 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-1997532228148381721</id><updated>2024-08-29T03:03:52.681+05:30</updated><category term="Getting Started with C#"/><title type='text'>Ravi Prakash Pandey&#39;s  Blogging site</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://coding-tipsntricks.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1997532228148381721/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://coding-tipsntricks.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Coder</name><uri>http://www.blogger.com/profile/04053641555538782615</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUrjd4OQS7xjWHWQhAl5yiQbnu_XcBVTEMOutIvhj_25xfEok9DVA1i-4rlsr5gKIptOv9IerrlxR7NKWUAZF8SZNhiW4iypFf66fS4iOYJXw7R5DkpxFY4bKKbSzF3vM/s220/DSC00079.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1997532228148381721.post-6236229269090829537</id><published>2009-12-29T16:52:00.008+05:30</published><updated>2009-12-29T17:15:51.338+05:30</updated><title type='text'>Difference between Server.Transfer Vs.  Response.Redirect</title><content type='html'>&lt;span style=&quot;color:#cceedd;&quot;&gt;Redirect and Transfer both cause a new page to be processed, but the interaction between the client (web browser) and server (ASP.NET) is different for each situation.&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color:#66ffff;&quot;&gt;Response.Redirect&lt;/span&gt;:&lt;br /&gt;&lt;span style=&quot;color:#cceedd;&quot;&gt;• First sends the request for the new page to the browser then browser sends the request for the new page to&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#cceedd;&quot;&gt;the webserver then after your page changes.&lt;br /&gt;Syntax: Response.Redirect (“Default1.aspx”);&lt;br /&gt;Or&lt;br /&gt;Response.Redirect (“www.google.co.in”);&lt;br /&gt;• The biggest problem is that this method causes each page to be treated as a separate transaction. Besides&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#cceedd;&quot;&gt;making it difficult to maintain your transactional integrity.&lt;br /&gt;• You can’t directly access the values, controls and properties of the previous page with Response.Redirect.&lt;br /&gt;&lt;span style=&quot;color:#66ffff;&quot;&gt;Example.&lt;/span&gt; Suppose you are currently on the Page1.aspx and now you are transferring the user to the Page2.aspx using Response.Redirect then When the Page2 page is requested, Page1 has been flushed from the server’s memory and no information can be retrieved about it unless the developer explicitly saved the information using some technique like session, cookie, application, cache etc. But in case of Server.Transfer variables can stay in scope and Page2 can read properties directly from Page1 because it’s still in memory, as you know the Server.Transfer just changes the focus from page1 to page2 So in this case browser doesn’t know that any change is happen there that’s why with this method you can access the information about the previous page.&lt;br /&gt;• Changes the URL in the browser’s address bar.&lt;br /&gt;• Response.Redirect can be used for both .aspx and html pages&lt;br /&gt;• Ex. Response.Redirect(“mypage.html”) OR Response.Redirect(“OtherPage.aspx”)&lt;br /&gt;• Response.Redirect can be used to redirect a user to an external websites.&lt;br /&gt;• There is a new Method called RedirectPermanent () on the HttpResponse Object. This method acts similar to&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#cceedd;&quot;&gt;Response.Redirect () except that the HttpResponse Code it sends out is 301 which indicates that the Page or&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#cceedd;&quot;&gt;Resource has moved permanently. Response.Redirect () returns Response Code 302, which indicates a&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#cceedd;&quot;&gt;temporary redirect.Response.RedirectParmanent () is an extension function introduced in .NET 4.0.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color:#66ffff;&quot;&gt;Server.Transfer&lt;/span&gt;:&lt;br /&gt;&lt;span style=&quot;color:#cceedd;&quot;&gt;• Instead of telling the browser to redirect, it simply changes the &quot;focus&quot; on the Web server and transfers the&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#cceedd;&quot;&gt;request .This means you don&#39;t get quite as many HTTP requests coming through, which therefore eases the&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#cceedd;&quot;&gt;pressure on your Web server and makes your applications run faster.&lt;br /&gt;• The &quot;transfer&quot; process can work on only those sites running on the server, you can&#39;t use Server.Transfer to&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#cceedd;&quot;&gt;send the user to an external site.&lt;br /&gt;• Server.Transfer retains the original URL in the browser’s address bar. It just replaces the contents of the&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#cceedd;&quot;&gt;previous page with the new one.&lt;br /&gt;• The Server.Transfer method also has a second parameter—&quot;preserveForm&quot;. If you set this to True, using a&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#cceedd;&quot;&gt;statement such as Server.Transfer (&quot;WebForm2.aspx&quot;, True), the existing query string and any form&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#cceedd;&quot;&gt;variables will still be available to the page you are transferring to.&lt;br /&gt;• For example, if your WebForm1.aspx has a TextBox control called TextBox1 and you transferred to&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#cceedd;&quot;&gt;WebForm2.aspx with the preserveForm parameter set to True&lt;span style=&quot;color:#3333ff;&quot;&gt;** &lt;/span&gt;, you&#39;d be able to retrieve the value of the&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#cceedd;&quot;&gt;original page TextBox control by referencing Request.Form (&quot;TextBox1&quot;).&lt;br /&gt;&lt;span style=&quot;color:#3333ff;&quot;&gt;**&lt;/span&gt;This has a bug whereby, in certain situations, an error will occur,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#cceedd;&quot;&gt;The unofficial solution is to set the enableViewStateMac property to “True” on the page you&#39;ll be&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#cceedd;&quot;&gt;transferring to, then set it back to “False”. This records that you want a definitive False value for this&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#cceedd;&quot;&gt;property and resolves the bug.&lt;br /&gt;• You can directly access the values, controls and properties of the previous page&lt;br /&gt;• Server.Transfer can be used only for .aspx pages and is specific to ASP and ASP.NET.&lt;br /&gt;• Server.Transfer(“mypage.asp”) OR Server.Transfer(“OtherPage.aspx”)&lt;br /&gt;• Server.Transfer can be used only on sites running on the same server. You cannot use Server.Transfer to&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#cceedd;&quot;&gt;redirect the user to a page running on a different server.&lt;br /&gt;• Mostly the Server.Transfer method is preferable to use because Server.Transfer is faster since there is one&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#cceedd;&quot;&gt;less roundtrip&lt;br /&gt;• Server.Transfer is not recommended since the operations typically flow through several different pages due&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#cceedd;&quot;&gt;to which you lose the correct URL of the page. &lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://coding-tipsntricks.blogspot.com/feeds/6236229269090829537/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://coding-tipsntricks.blogspot.com/2009/12/difference-between-servertransfer-vs.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1997532228148381721/posts/default/6236229269090829537'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1997532228148381721/posts/default/6236229269090829537'/><link rel='alternate' type='text/html' href='http://coding-tipsntricks.blogspot.com/2009/12/difference-between-servertransfer-vs.html' title='Difference between Server.Transfer Vs.  Response.Redirect'/><author><name>Coder</name><uri>http://www.blogger.com/profile/04053641555538782615</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUrjd4OQS7xjWHWQhAl5yiQbnu_XcBVTEMOutIvhj_25xfEok9DVA1i-4rlsr5gKIptOv9IerrlxR7NKWUAZF8SZNhiW4iypFf66fS4iOYJXw7R5DkpxFY4bKKbSzF3vM/s220/DSC00079.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1997532228148381721.post-8856173421861831123</id><published>2009-12-26T14:17:00.002+05:30</published><updated>2009-12-26T14:22:15.786+05:30</updated><title type='text'>What is Encapsulation and a simple Example</title><content type='html'>Encapsulation hides the internal state and behavior of an object. Encapsulation if used with access modifiers such as private, public, protected. It provides a way to protect data.&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;public class MyClass&lt;br /&gt;{       &lt;br /&gt;   private string name;       &lt;br /&gt;   public string Name       &lt;br /&gt;    {&lt;br /&gt;      get&lt;br /&gt;       { &lt;br /&gt;         return name; &lt;br /&gt;       }&lt;br /&gt;      set&lt;br /&gt;       {&lt;br /&gt;         name = value;&lt;br /&gt;       }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;public class main&lt;br /&gt;{&lt;br /&gt;  public static int Main(string[] args)        &lt;br /&gt;   {&lt;br /&gt;     MyClass myclass = new MyClass();&lt;br /&gt;     myclass.name = &quot;Communication&quot;;  &lt;br /&gt;     Console.WriteLine(&quot;The name is :{0}&quot;, myclass.Name);&lt;br /&gt;     return 0;&lt;br /&gt;   }&lt;br /&gt;}</content><link rel='replies' type='application/atom+xml' href='http://coding-tipsntricks.blogspot.com/feeds/8856173421861831123/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://coding-tipsntricks.blogspot.com/2009/12/what-is-encapsulation-and-simple.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1997532228148381721/posts/default/8856173421861831123'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1997532228148381721/posts/default/8856173421861831123'/><link rel='alternate' type='text/html' href='http://coding-tipsntricks.blogspot.com/2009/12/what-is-encapsulation-and-simple.html' title='What is Encapsulation and a simple Example'/><author><name>Coder</name><uri>http://www.blogger.com/profile/04053641555538782615</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUrjd4OQS7xjWHWQhAl5yiQbnu_XcBVTEMOutIvhj_25xfEok9DVA1i-4rlsr5gKIptOv9IerrlxR7NKWUAZF8SZNhiW4iypFf66fS4iOYJXw7R5DkpxFY4bKKbSzF3vM/s220/DSC00079.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1997532228148381721.post-2222170513732982424</id><published>2009-12-17T17:07:00.001+05:30</published><updated>2009-12-17T17:10:40.704+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Getting Started with C#"/><title type='text'>First C# Console application</title><content type='html'>Starting with the basic program i.e displaying a message using console application.&lt;br /&gt;The below mentioned program has&lt;br /&gt;1) namespace : e.g. using System;&lt;br /&gt;2) a class : e.g. Class Consoledemo{… }&lt;br /&gt;3) a Main method : e.g. static void Main() {….}&lt;br /&gt;4) statement : e.g. console.writeline(“This is my first article for my site”);&lt;br /&gt;&lt;br /&gt;How a complete program in c# look:&lt;br /&gt;&lt;span style=&quot;color:#33cc00;&quot;&gt;// Namespace Declaration&lt;/span&gt;&lt;br /&gt;using System;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color:#33cc00;&quot;&gt;// Program start class&lt;/span&gt;&lt;br /&gt;class Consoledemo&lt;br /&gt;{&lt;br /&gt;&lt;span style=&quot;color:#33cc00;&quot;&gt;// Main begins program execution.&lt;/span&gt;&lt;br /&gt;static void Main()&lt;br /&gt;{&lt;br /&gt;&lt;span style=&quot;color:#33cc00;&quot;&gt;// Write to console&lt;br /&gt;&lt;/span&gt;Console.WriteLine(&quot;This is my first article for my site&quot;);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;How to compile a c# code through command line:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;CSC.exe Consoledemo.cs&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://coding-tipsntricks.blogspot.com/feeds/2222170513732982424/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://coding-tipsntricks.blogspot.com/2009/12/first-c-console-application.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1997532228148381721/posts/default/2222170513732982424'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1997532228148381721/posts/default/2222170513732982424'/><link rel='alternate' type='text/html' href='http://coding-tipsntricks.blogspot.com/2009/12/first-c-console-application.html' title='First C# Console application'/><author><name>Coder</name><uri>http://www.blogger.com/profile/04053641555538782615</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUrjd4OQS7xjWHWQhAl5yiQbnu_XcBVTEMOutIvhj_25xfEok9DVA1i-4rlsr5gKIptOv9IerrlxR7NKWUAZF8SZNhiW4iypFf66fS4iOYJXw7R5DkpxFY4bKKbSzF3vM/s220/DSC00079.JPG'/></author><thr:total>1</thr:total></entry></feed>