Bilal Haidar [MVP, MCT] Official Blog

Microsoft MVP ASP/ASP.NET, MCP, MCTS, MCPD, MCT
Welcome to Bilal Haidar [MVP, MCT] Official Blog Sign in | Join | Help
in Search

Browse by Tags

All Tags » ASP.NET 1.x » ASP.NET 2.0 - General
  • Server Variables

    I always find a difficulty in remembering all the server variables and how they can help me, here is a list of all the server variables I ran in a testing application. You will see the server variables with a sample data coming from the testing application: ALL_HTTP HTTP_CONNECTION:Keep-Alive HTTP_ACCEPT:*/* HTTP_ACCEPT_ENCODING:gzip, ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on January 18, 2007
  • HttpSessionState and ASP.NET Exception

    A nice trick I read in the ASP.NET 2.0 Core Reference is that, when an exception occurs at the end of the request, that is the GetLastError of the Server object returns an exception, the Session data is lost, however, in your handler of the Exception, if you call Server.ClearError, the Session is restored! That is a great tip Dino, ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on November 25, 2006
  • Filter Collection of Objects

    I have been developing an API for an application of mine at work. The API returns a set of objects in the form of Collections. I needed a way to filter the collection based on some values I provide. I have passed by this blog post: http://codebetter.com/blogs/brendan.tompkins/archive/2004/09/02/24116.aspx Brendan creates something known as ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on October 4, 2006
  • Session_End and HttpRuntime

    I had a need few days ago to delete some files in the Session_End. As you know, Session_End will be fired, even if the client's session ends, because the Session is based on the Server and therefore, after the Session times-out the Session_End on the server will be executed. However, I needed to use some properties from the HttpContext and it ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on May 22, 2006
  • Looping Through Page Controls

    A very common question on the ASP.NET forums, is how to loop through the page controls, and find dynamically my control! Here is the solution, its R E C U R S I O N !! A very simple example, that loops through the page controls, and once it finds a Panel, it prints out, I am a Panel   public void ShowPanels(Control p_Control) { ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on May 18, 2006
  • String Enumeration in C#

    I have always had the need to use String Enumerations. What do I mean by that? Suppose we have this Enum Type: public enum StringNames { Bilal, Wessam, Elsa, Samer, Tarek, Farah, Firas, Mohammad } In my code, I would like to have something as: string _Name ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on May 12, 2006
  • Modal Dialog Window Caching Problem

    Hello: Suppose you open a Modal Dialog window inside your ASP.NET page. In that dialog window, you have a GridView, DataGrid, or whatever control. Do some changes on that control, you will see that the data has changed right? Ok, then close the dialog window, then open it again from the ASP.NET Page, you will see the old data and not the ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on April 28, 2006
  • Define Custom Events in UserControls

    A very common question on the ASP.NET forums is: How to define an event in a UserControl, and process this event in the Page holding this UserControl? The answer is simple, follow this post, and you will be able to define your own events very easily. We have the following UserControl file together with the Code Behind as follows: <%@ ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on April 25, 2006
  • Define a Custom Event inside UserControls

    If you are working with either a new custom server control or a normal web user control, this is the proper way of adding an event that can be handled by the parent control of the child control you are develping: Add the following to the control (Server Control / Web User Control ) being developed: #region Event Handler private static readonly ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on April 13, 2006
  • DateTime Formatting in ASP.NET 2.0

    This is a nice summarized sample code on how to format DateTime instances:// This code example demonstrates the String.Format() method. // Formatting for this example uses the ''en-US'' culture. using System; class Sample { enum Color {Yellow = 1, Blue, Green}; static DateTime thisDate = DateTime.Now; public static void ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on March 29, 2006
  • CurrentCulture & CurrentUICulture

    There has been always a popular question on the ASP.NET forums about the difference between CurrentCulture and CurrentUICulture. I wanted to distinguish things in this post and make it clear once and for all. CurrentCulture and CurrentUICulture are both of type CultureInfo which is part of the  System.Globalization. CurrentCulture and ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on March 19, 2006
  • Server.MapPath Analysis

    While working with the HttpContext.Current.Server.MapPath(), I discovered something which is that, the MapPath method starts seeking a path Starting from the current directory you are in and not directly from the root directory. Hope this hint helps, Regards  
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on March 10, 2006
  • HttpHandlers, HttpModules, and the FormsAuthentication

    I have been working on a Global Error Logging & Handling solution for a web application that is part of a huge system we have been developing in my company. I used an HttpModule to get attached to the Application_Error event, where I instantiate my own error handler classes and process the error. The processing is done though ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on March 9, 2006
  • Using Method inside a DataGrid or GridView TemplateField

    Sometimes there is a need to do some action on a field returned from the database and displayed inside a TemplateField inside the DataGrid or GridView columns. For example, you might have an email address inside your database and you want to set the HREF of the a tag as a link with the ''mailto:'' appended at the beginning of the ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on March 5, 2006
  • Difference between NULL and DBNull

    I have always misunderstood the difference between NULL and DBNULL until recently while I was working on ASP.NET web application, and was talking to a Webservice and I found an exception coming from one of the web methods inside the Webservice which is using the SqlCommand.ExecuteScalar() method. What happens when the ExecuteScalar() method is ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on March 4, 2006
  • ASP.NET and DNN Website deploy

    When you developer an ASP.NET web application or a DotNetNuke application, you will be having all types of file extensions: .csproj .cs .vb .su .sln etc ... So, imagine you are developing a huge web application or even a DotNetNuke website and now it is time to deploy your application. Are you going to go through each single folder in ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on March 4, 2006
  • Security Training Modules

    There is a very nice module on Security Patterns in ASP.NET (1.x/2.0). You can check it at: Security Training Modules Hope that helps, Regards
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on February 23, 2006
  • Password TextBox and PostBack

    Sometimes in an ASP.NET (1.x/2.x) webform, we might have a Password TextBox, and one of the DropDownLists or RadiobuttonLists or any control present inside the web form might do a postback before you need to submit the form. Every time this happens, I loose the Password TextBox value. A solution that might help you preserve the Password ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on February 19, 2006
  • DataList Show/Hide Table Rows

    In the last few days, I was working on a Custom DotNetNuke Module, which is called ContactUs, which I will be using in one of the projects currently under my hands. I wanted to list all entries of the ContactUs form that are stored in the database. So I decided to use the DataList, in which I place my own Table inside the ItemTemplate. There are ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on February 11, 2006
  • CountryList SQL Script

    I am working on a Custom DotNetNuke module. I wanted to have a DropDownList of all the countries in the world. I had to google a little bit to find all the countries available, which I beleive are 222 countries. I wanted to share with you the SQL Script I created. You can download this script from the Files Area. When you run this script using ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on February 10, 2006
  • Good Links to Share

    I would like to share with you the following two links, which I beleive are good and useful. String Formatting in C# Url Rewriting with Regex for ASP.NET 2.0 Regards  
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on February 8, 2006
  • Unable to Start Debugging on the Server. You do not have permission to debug

    Have you ever faced that error before? I have started development lately on a Windows 2003 Standard Server, having both VS.NET 2003 and VS.NET 2005 installed. I was trying to open a DotNetNuke project yesterday and got the error by VS.NET 2003: Error while trying to run the project  : Unable to Start debugging on the web server. You ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on January 14, 2006
  • Bit Column in Microsoft SQL Server

    In my work today, I faced a very weird thingy, here it is: I was retreiving a bit column from the table whose default value is set to 0, and then using an SqlDataReader, and the weird thing is that I used: 1- (bool)reader[col]2- Convert.ToBoolean(reader[col]])3- reader.GetInt32(col) Nothing worked ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on January 11, 2006
  • Visual Studio .NET and Class Libraries

    When I start a new project, I usually create a Blank Solution in VS.NET, then add to it my Class Libraries and Web Application. The problem I used to have before is that, every time I did some changes in one of the Class Libraries I had to update the references manually to all other projects referencing that updated Class Libraries. Thank to ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on January 11, 2006
  • DateTime Methods

    I had today to work with some DateTime calculations. I need two methods: 1- Get time difference between two dates, in such a way to have the following formats in the returned value: - Hours - Minutes (01 -> 1 minute, 10 -> 10 minutes,...) - Seconds - Hours.Minutes - Hours:Minutes:Seconds 2- Add a double value for a DateTime - double ...
    Posted to Bilal Haidar [MVP, MCT] (Weblog) by BilalHaidar [MVP] on July 13, 2005
Powered by Community Server (Personal Edition), by Telligent Systems