Wednesday, November 18, 2009

Aboug WPF refer links

http://www.wpftutorial.net/LearnWPFin14Days.html
http://windowsclient.net/learn/videos_wpf.aspx
http://idealprogrammer.com/languages/visual-basic-vbnet/windows-presentation-foundation-18-hours-of-free-video-tutorials/

Friday, November 13, 2009

Global.ascx

<%@ Application Language="C#" %>

<script runat="server">


void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
Application["Hits"] = 0;
Application["Sessions"] = 0;
Application["TerminatedSessions"] = 0;
}
//new
//The BeginRequest event is fired for every hit to every page in the site
void Application_BeginRequest(Object Sender, EventArgs e)
{
Application.Lock();
Application["Hits"] = (int) Application["Hits"] + 1;
Application.UnLock();
}
void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started
Application.Lock();
Application["Sessions"] = (int) Application["Sessions"] + 1;
Application.UnLock();
}
void Session_End(object sender, EventArgs e)
{
// Code that runs when a session ends.
// Note: The Session_End event is raised only when the sessionstate mode
// is set to InProc in the Web.config file. If session mode is set to StateServer
// or SQLServer, the event is not raised.

Application.Lock();
Application["TerminatedSessions"] =
(int) Application["TerminatedSessions"] + 1;
Application.UnLock();
}
void Application_End(object sender, EventArgs e)
{

string _write="Total Hits="+Application["Hits"].ToString()+"<br>Total Sessions="+Application["Sessions"].ToString()+"<br>Expired Sessions:="+Application["TerminatedSessions"].ToString();
// Code that runs on application shutdown
//Write out our statistics to a log file
//...code omitted...
System.Collections.Generic.List<string> allLines = new System.Collections.Generic.List<string>();
allLines.Add(_write);
string[] _LastContent = allLines.ToArray();

System.IO.File.WriteAllLines("merged.txt", _LastContent);

}
void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs

}

//The global.asax file in Listing 3.8 contains event handlers for the Session and Application objects. Each event handler has the same signature as the Page_Load event handler.
//The code in Listing 3.8 handles three Application object-related events: Start (Lines 3-8), End (Lines 24-30), and BeginRequest (Lines 11-16). Start and End are called when the Web application starts and ends, respectively. BeginRequest is called for every page hit that the site receives. Listing 3.8 updates the total number of hits on this event.
//The Session Start (Lines 17-22) and End (Lines 24-30) events are handled in the middle of the listing. These two events count how many different Web users have accessed the site.
//You can write a simple page to utilize the statistics that Listing 3.8 tracks. Listing 3.9 shows a page that writes out the results of the hit-counting code

</script>

//------------------------------The links----------------
Detals about global.ascx