Geeks With Blogs
Nouman Zakir while (true) { Post.NewArticle(); } January 2009 Entries
Log uncaught application exceptions
It's very important to log any uncaught exceptions that your ASP.NET application generates. Otherwise you may not be aware of serious problems with your website. You can trap exceptions by writing an Application_Error method in Global.asax. Call Server.GetLastError() to get the exception.I recommend logging the following data so that you'll be able to troubleshoot the problem: Data How to Retrieve Current Time DateTime.Now Request IP Address Request.UserHostAddress Referring URL (page user was on ......

Posted On Sunday, January 25, 2009 3:50 AM

Performance counter without overflow
Environment.TickCount returns a 32-bit signed integer containing the amount of time in milliseconds that has passed since the last time the computer was started. But this value can overflow for systems that stay up for days at a time. To avoid this overflow problem, you can query the "System Up Time" performance counter: public TimeSpan SystemUpTime() { PerformanceCounter upTime = new PerformanceCounter("System", "System Up Time"); // You've got to call this twice. First time it returns 0 and the ......

Posted On Sunday, January 18, 2009 6:13 AM

Save Configuration Settings in Registry
First, go to AssemblyInfo.cs and remove all asterisks from the AssemblyVersion: [assembly: AssemblyVersion("")] Otherwise, every time you build your application the registry key will change. Save configuration values to the registry as follows: Application.UserAppDataRegi... Value); Load configuration values to the registry as follows: try { Value = (int) Application.UserAppDataRegi... } catch(Exception) { } The GetValue method will throw an exception ......

Posted On Sunday, January 11, 2009 9:58 PM

Hello world!
class HelloWorldApp { static void Main() { System.Console.WriteLine("H... world!"); } } ......

Posted On Friday, January 2, 2009 5:16 PM

Copyright © Nouman Zakir | Powered by: