Wednesday, July 31, 2002

Sample C# session code

HttpSessionState userSession = HttpContext.Current.Session;
userSession.Timeout = 10;
userSession["DefaultHomePage"] = "
www.fellowshipchurch.com";
userSession["ValidUser"] = true;
Debug.WriteLine("The session timeout is " + userSession.Timeout.ToString() + " " + Session.Timeout.ToString());
userSession["DefaultMinistry"] = "Spiritual Development";
Debug.WriteLine("The session ID is " + Session.Contents.SessionID.ToString();
Session.Contents.RemoveAll();


4:58:45 PM  #  

When you begin a .NET web application project, the global.asax file is automatically created. Within the file is a method called protected void Session_End (Object sender, EventArgs e). For a number of days, I made numerous attempts to have code within this method called, all to no avail. While scouring web message boards, I came across a couple of VB code samples that involved Session_End, but happen to use the name Session_OnEnd.

As soon I changed the name of the method to Session_OnEnd and terminated a session, the code was called (using C#)! As far as I can tell, the session start method can be either Session_Start or Session_OnStart.


4:45:16 PM  #  

Each Active Directory object has four unique names.

Distinguished name (DN):  The DN contains the full information (i.e. path) needed to retrieve the object. It utilizes the DomainComponentName (DC), OrganizationalUnitName (OU), and the object's CommonName (CN). For example, /DC=fc.com/OU=Main/CN=support.

Relative distinguished name (RDN): The RDN is the CommonName (CN) portion of the DN.

Globally unique identifiers (GUID): A 128-bit unique, numerical identifier of each object.

User principal names (UPN): support@fc.com


4:17:17 PM  #  

There are two SQL Server utilities from the Resource Kit to pay particular attention to. First is the DBManagement MMC for performance and statistics. The second is Database Hammer for load testing. They are both located in the ToolsandSamples folder on the CD.


2:59:33 PM  #  

Active/Active Cluster

For active/active mode, you have more than one SQL instance. Each instance should have its own disk array to host database files. When failover happens, both SQL instances will run on the remaining node.

Two shared storage areas are used. In a normal working state, each is controlled by one node in the cluster, so both data and log must reside on that same shared storage.

With Active/Active you have two Clustered Resource Groups. One runs with DB01 as primary and DB02 as secondary. The other uses DB02 as primary and DB01 as secondary. Under normal circumstances, each system is running its own Resource Group, taking on the other as additional work if there is a failure of that other system. For these situations you need a separate Virtual Server for each of the Clustered Resource Groups.

You are running SQL server on both nodes. Each SQL instance will have one dedicated shared disk. From which node the instance is running is of no significance, since the data files are on the shared drive.

Tips compiled from numerous SQL related newsgroups.

 


2:55:24 PM  #  

Active/Passive Cluster

One shared storage area which is controlled by whichever node is currently active.

One Clustered Resource Group which runs on one system (node) only at any given time. The secondary system is only used in the event of failure of the Primary.

One SQL instance.


2:49:14 PM  #  

SQL Cluster

The Quorum drive should be on its own physical disk array (RAID 1).

Although it is recommended that the quorum drive only be used by the quorum, MSDTC is an exception to this rule.

Cluster disk resources used by SQL Server should not be used for other cluster services (such as the quorum drive, file or printer shares, or Internet Information servers) unless the cluster has only one cluster disk resource. If you do use the SQL Server cluster disk for any of these resources, it may significantly affect your failover time and may also initiate failovers of SQL Server when no SQL Server problem exists.

All drives that are used by the database when restored must have a dependency on the SQL Server cluster resource. Check the dependencies you will find that not all of your drives are listed.

Your clients connect to a virtual server without knowing which physical system is currently handling the Clustered Resource Group.

In sql server, instance is a sql service not database. If you have 2 instances on the cluster, that means you have 2 virtual sql servers with separate names. Each virtual sql server has a set of databases on it. Both sql server can run on same node in the cluster or one on each node. When failover happens, affected sql service will failover to active node from failed node but still holds virtual sql server name and all databases in it. Unaffected sql service will not take over databases from affected sql service. From user point of view, nothing is change even it runs on another node now.

Tips compiled from numerous SQL related newsgroups.


2:44:30 PM  #  

Visual SourceSafe

For Administrators

Run Analyze & Repair on database once per week.

Synchronize time between fc-devapp01 and workstations.

Perform daily FULL backups of the SourceSafe database.

For Users

Only use the IDE for managing files.

Do not check out and check in files from both VSS and the IDE. Doing this only once causes the files to get out of sync.

Save all web projects to http://localhost/projectname.

Within Visual Studio, create blank Solutions, followed by Projects within the Solution.

When opening a project for the first time, choose Open from Source Control.

The next time you open the project, use Open Project.

For web applications, it is recommended that you check out the entire solution if possible.

A project can be part of more than one solution, but a solution must be unique.

When you check out a web form (aspx) or code-behind file (aspx.cs), VS .NET automatically checks out both files.

Rename or deletions that are performed with the Visual Studio .NET IDE are not automatically propagated to VSS and vice-versa. As a result you must use VSS Explorer in conjunction with Visual Studio .NET.

Tips compiled primarily from Microsoft's Team Development Guide for SourceSafe.


2:15:45 PM  #  

.NET Web Deployment

If you are using VS.NET, the only files you need to copy to the production server are the DLL (found in the bin directory) and aspx pages.

If there is change in code-behind only, you need only copy the new dll to the server's bin folder. If there is a change in the UI then copy the aspx files as well.

Create a deployment project for your web app inside the same solution. Simply using Copy Project and other basic methods will most likely not work with more advanced projects. Additionally, Crystal Reports requires various merge modules which are not captured by these methods.

If you run into an "unrecoverable build error" when building a Setup and Deployment project, close all editors and the Solution Explorer. If you continue having trouble, try repairing your VS .NET installation.


1:54:46 PM  #  

IIS

To use more than 2GB of RAM on an IIS server, use the /3GB switch in boot.ini

From Dell support: "By default, Microsoft Windows 2000 Advanced Server permits only 2GB of the installed memory to be allocated as user memory. With the advent of Microsoft Windows 2000 Advanced Server user applications like Exchange can utilize up to 3GB of memory. The remaining 1GB of a 4GB system can be reserved as system memory for use by the Windows 2000 Advanced Server system and is unavailable as user memory. After installing Microsoft Windows 2000 Advanced Server you can modify your system to utilize the 4GB of memory. To enable the 3GB user memory feature you will need to edit the system hidden file c:\boot.ini and add the command line option /3GB to the boot up string and reboot your system."

[operating systems]

multi(0)disk(0)rdisk(0)partition(0)WINNT="Windows 2000 Advanced Server [3GB user]" /3GB

The Memory: Page Faults/Sec Counter The Memory: Page Faults/sec counter monitors the number of times an operating system virtual page was not found in memory. When a page is not found in memory, the operating system must retrieve the page from disk. The time it takes to retrieve a page from disk is always longer than the time required to retrieve the page from memory. A number consistently above zero indicates too much memory allocated to an application and not enough to Windows NT.


1:43:17 PM  #  
Using Amazon's New Web Services. Amazon.com recently launched its Web services API initiatives, allowing customers to integrate its vast online content with their own web site. The author demonstrates how you can make use of this Web service using Visual Studio .NET. [O'Reilly Network Articles]
9:58:05 AM  #