Friday, July 30, 2010 7:48:14 AM
I just ran into a problem with auto generated Resource Classes for .resx files in the App_GlobalResources folder. By default the runtime generates Proxy classes to access the content of neutral sample.resx files by code. If you add other languages (e.g. German like sample.de.resx) this file is recognized as a language specific version of the neutral file and no proxy is generated. This is fine.
Problem: If you add a sample.zh.resx for the Chinese version you get an error "...already contains a definition for..." because there is no invariant zh culture! So the runtime tries to generate a neutral proxy...for most languages there is an invariant version (http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo%28VS.71%29.aspx) but not for Chinese. You have to choose a specific culture instead. e.g. zh-CHS for traditional Chinese.
Monday, March 29, 2010 2:21:12 AM
To check your target web server environment for installed CLR versions you can use the follogin script which runs through the registry to determine the installes CLR versions on a host. Just paste the text below into a .aspx file. That' all.
<%@ Page Language="VB" %>
<%@ Import Namespace="Microsoft.Win32" %>
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim componentsKeyName As String = "SOFTWARE\Microsoft\NET Framework Setup\NDP"
Dim componentsKey As RegistryKey = Registry.LocalMachine.OpenSubKey(componentsKeyName)
Dim instComps As String() = componentsKey.GetSubKeyNames()
For Each instComp As String In instComps
Dim key As RegistryKey = componentsKey.OpenSubKey(instComp)
If instComp IsNot Nothing AndAlso instComp.StartsWith("v") Then
lblVersion.Text = lblVersion.Text & instComp & " SP " & key.GetValue("SP") & ", "
End If
Next
End Sub
</script>
<html>
<head runat="server">
<title>CLR Versions</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Label ID="lblVersion" runat="server">Your server is running ASP.NET and the versions are: </asp:Label>
</form>
</body>
</html>
Thursday, December 10, 2009 1:06:51 AM
With custom Personalization Providers it's easy to create your custom store (DB, XML, flat file, etc) eg. for editable Web Parts. But you get only a BLOB created by the WebPartManager to deal (store, retrieve, clear, etc) with and cannot read the actual content of the Personalization. This is why you cannot create a Full Text Search over personalized Web Pages easily. To achieve this you have to deserialize the WebPartManager's BLOB which format is kind of cryptic and not documented. So I used Lutz Roeder 's .Net Reflector before it was bought by Red Get sneaked into Microsoft's Code and extracted the relevant code for Serialization and Deserialization of these BLOBs.
Here is a schematic overview of what you can do with this Full Text Personalization Provider Framework. Download sample Project to support Full Text Search. All you need to do is implement your custom storage: CustomPersonalization.zip

Wednesday, November 25, 2009 3:25:03 AM
Yes!
This file does what you are thinking. When a file named "app_offline.htm" is found in the web app's root directory IIS unloads the application and stops serving any pages for this application. Every request will be redirected to app_offline.htm instead allowing you to perform your maintainance task.
(!) But be aware that really no other content will be served meaning that even the CSS must be included in the app_offline.htm and images will not work either.
The solution is to host stylesheets and images in annother application (or anywhere else on the web) and include them in the app_offline.htm - tadaaa.
Friday, November 13, 2009 12:23:46 PM
A great and grad web testing environment for .net is WatiN. It enables you even to read out values on pages and create a full web regression testing tool. Unfortunately the second version if the test recorder is still in beta and quite unusable but working with the 1.0 version makes real input - output test for web forms very easy. All of this in combination with a Testing suite like nUnit makes regression testing a quick and easy to handle task! There is even a free NUnit integration in Visual Studio 2008!
I just love it!
http://watin.sourceforge.net/
http://watintestrecord.sourceforge.net/
Tuesday, November 03, 2009 11:34:02 AM
Unfortunately I did not find a clean way to apply a custom order a WebPart's Properties in the PropertyGridEditorPart. Apparently the it is ordering the Elements alphabetical desc by the Property Name. This can be quite ugly when eg. Textboxes for Strings and CheckBoxes for Booleans are mixed and mangled. To apply a custom order you must name the relevant WebBrowsable Properties accordingly. But to maintain a neat readable Layout you can apply the WebDisplayName Attribute.
So although the alphabetical order of the displayed PropertyDescription is different (S before T)
I managed to display this order:
relevant code snippet:
[WebBrowsable(true), Personalizable(PersonalizationScope.Shared), WebDisplayName("Searchable"), DefaultValue(true)]
public bool x_Searchable
{
get
{
return searchable;
}
set
{
searchable = value;
}
}
[WebBrowsable(true), Personalizable(PersonalizationScope.Shared)]
public bool Title
{
get
{
return title;
}
set
{
title= value;
}
}