Montag, 8. Juni 2009

LINQ to SQL Debug Visualizer

 

A nice Visual Studio plug in that allows to visualize linq queries.

LINQ to SQL Debug Visualizer - ScottGu's Blog

Freitag, 29. Mai 2009

Internet Explorer and Delicious

 

This rocks. I can use my google blog using Internet Explorer integrated with delicious.

Quick Tour of Internet Explorer on Delicious

Samstag, 9. Mai 2009

VB.NET and C# Comparison

VB.NET and C# Comparison

ASP.Net Paths

A nice overview about the confusing path properties of ASP.NET Making sense of ASP.Net Paths - Rick Strahl's Web Log

Montag, 27. April 2009

Add IIS custom headers programmatically

I was looking for a solution to add custom headers for IIS virtual folders or subfolders. There is a way using cscript.exe and adsutil.vbs in the AdminScript directory of InetPub. 
But here is a much more elegant way to do it. Add a reference to System.DirectoryServices to your project and you can modify headers in your deployment project or whereever like this.
 Protected Sub AddCustomHeaders(ByVal virtualDirName As String)
     
       Dim strPath As String = "IIS://localhost/W3SVC/1/Root/" & virtualDirName
       Dim de As DirectoryEntry = New DirectoryEntry(strPath)
       Dim myEntries As DirectoryEntries = de.Children
       ' Find Images Folder
       For Each entry As DirectoryEntry In myEntries
           If entry.Name = "Images" Then
               'Add a custom header (here Ie6 Cache Bugfix)
                entry.Properties("HttpCustomHeaders").Add("Cache-Control:post-check=900,pre-check=3600")
               entry.CommitChanges()
               Exit For
           End If
       Next

   End Sub
This header solves the issue that IE6 doent cache images. Its a bad idea to put the Cache-Control entry to the Virtual Directory folder. Because everything will be cached. If you do it in code, only aspx pages are affected - but not the images. So just add the Cache Control to your images subfolder and the flicker problems are gone. If you want to do it in a bash you can choose this way. Change directory to C:\inetpub\AdminScripts
cscript.exe adsutil.vbs set w3svc/1/ROOT/YOURVIRTUALDIR/Images/HttpCustomHeaders "X-Powred-By: ASP.NET" "Cache-Control: post-check=900,pre-check=3600"
'End Try