Tuesday, May 23, 2006

Eric says crazy filename parsing is something else you should stop doing.  If you're creating output files, you probably need to timestamp the file name to keep the files separate.  Step away from the keyboard before you do anything crazy--you can do this in one line of VB.NET:

Dim _filename As String = String.Format("MyFile.{0}.xml", Now.ToString("yyyyMMddHHmm"))

 

Tuesday, May 23, 2006 5:17:00 PM (Eastern Standard Time, UTC-05:00)
 Monday, April 17, 2006

If you're still formatting dates as such:

lblDate.text = datepart("d",Now) & "/" & datepartt("m",now) & "/" & datepart("yyyy",now)

then stop this instant!  Step away from the keyboard and no one gets hurt.

There are better ways in ASP.NET to format dates.  You could replace the above line of code with:

lblDate.text = getdate().tostring("MM/dd/yyyy")

and end up with exactly what you needed.  ASP.NET is full of great format strings.  Remmeber the old FormatCurrency(MyCash) command?  You can replace that with MyCash.ToString("C").  Download the .NET 2.0 SDK and look up "formatting strings"; you'll find all these goodies in there.

Monday, April 17, 2006 12:34:46 PM (Eastern Standard Time, UTC-05:00)
 Sunday, April 09, 2006

In my article on Preventing Page Review After Logout With Forms Authentication, I talked about several HTTP headers that can be used to direct browsers not to cache pages locally.  In one comment, a reader said they had used the article's code, but Firefox was still caching pages.  Another reader left a comment about using the "cache-control: no-store" header to prevent Firefox from caching pages.  If you see that Firefox is caching secured pages, try adding this header to your pages.  If possible, add it to your master page or page template.

ASP.NET, you can set this header by using the HttpCachePolicy.SetNoStore method.  Put this in your page_load at the latest.  You can also set this in your page's HEAD section  by adding the following line of code:

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">

In the IIS control panel, you can set headers to be automatically added to every response.  This is discussed briefly at http://support.microsoft.com/kb/815313/, but if you're in a shared host environment, you probably don't have access to the IIS control panel.

The "Cache-Control: No Store" header can cause problems with PDF files in IE 6.  Microsoft has a KB article on this at http://support.microsoft.com/default.aspx?scid=kb;en-us;812935.  File downloads via SSL may also beimpacted if you use this header; see http://support.microsoft.com/?kbid=323308 for more details.  This second article involves a registry edit.

Also, remember that browsers need to cache image files if you're using image rollovers, so be careful where you use any of these headers.  You might mess up your menu.

Sunday, April 09, 2006 10:17:29 AM (Eastern Standard Time, UTC-05:00)
 Sunday, May 22, 2005

They do exist!  For some reason, the Issue Tracker Starter Kit download page was reverted to an older version.  Alex Lowe was kind enough to post the links in the Issue Tracker Starter Kit forum:

http://asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=832749

Sunday, May 22, 2005 7:03:54 AM (Eastern Standard Time, UTC-05:00)