Category: ASP.NET

ASP.NET tutorials and snippets

  • Sending E-Mail in ASP.NET and C#

    Sending e-mail in asp.net is a simple two step process. First you have to add the mail settings in the web.config file. Adding this will enable your site to send mail. Next, Create a aspx page to send mail using this settings. This code can…

  • Converting Virtual Directory into an Application to run ASP.NET in IIS

    Whenever you created an asp.net website using VWD or Visual studio (Which worked perfectly) and then tried run the same site through IIS (Internet Information Server) you may encounter the following error:- Server Error in ‘/’ Application. Configuration Error Description: An error occurred during the…

  • Integrating FCKeditor in ASP.NET

    Integrating FCKeditor in ASP.NET

    FCKeditor is the most popular online HTML text editor and widely used in most of the web sites. It comes with an FCKeditor.NET control exclusively for ASP.NET applications. However there are no proper instructions or tutorial on how to integrate the FCKeditor into your ASP.NET…

  • Adding , removing and Clearing session values

    This just a small snippet to add, clear and remove all the session values in C#. To add and remove a session value To add Session[“username”] = “JonDoe”; To Remove Session[“username”] = “”; To clear and remove all the session values Session.Contents.RemoveAll(); Session.Abandon();

  • Adding Access Database Connection String in web.config file

    Hi here is a small snippet. If you have your access database in your app_data folder and need to add its connection string in the web.config file, so that you can use in your business tier or code behind, here is the snippet.

  • Maintaining Scroll Position after PostBack

    Here is code snippet to maintain the scroll position after post back. Application level Add the following line in your web.config file or modify the existing one Page Level Add the the following attribute in the page directive of your aspx page Code level Even…

  • Setting DropDownlist Selected Value from Code Behind in ASP.NET C#

    If you have a DropDownList control with some values in your .aspx page you can pre select any values in your code behind file. It can be selected either seting the SelectedIndex property or SelectedValue property. .aspx page: Code Behind .CS file: For the first…

  • SWITCH Statement in ASP.NET C#

    I like to use switch statement rather than using continuous if statement or atleast if I have to use more than 3 if statement. The syntax and example can be a good reference. SYNTAX: Example:    

  • Iterating Through ServerVariables in ASP.Net and C#

    Sometimes you may need to verify all the servervariables to debug your code. Simply iterating through the servervariables collection can bring out the result. The following snippet is suffice to iterate. code behind .aspx file