URL Case Sensitivity and Assembly Loading
URL is case sensitive.
In Windows file names are case insensitive.
When these two meet, you can sense some inconsistence here.
When an http assembly is requested, it has to be copied into download cache, before it is returned to you.
Download cache is indexed by the URL. Now we have to consider the URL case sensitivity issue.
If we treat the URL as case sensitive, it means assembly https://foo/bar.dll will be considered as different from assembly https://foo/BAR.dll. If those two URLs mean different assemblies then we are fine. Unfortunately, if the web server is IIS, those two URLs really mean the same assembly. Weird problems happen when we consider them as different ( typical one is InvalidTypeCast error).
Thus we index the download cache by the URL as case insensitive.
This essentially means, URL for assembly is case sensitive, in the client side.
In .Net framework v1.0/v1.1, when we go probe for assembly foo, we will look for file foo.DLL, with the extension capitalized. If your web server treat URLs are case sensitive (like Apache), you need to be aware of this.
In .Net framework v2.0 beta 1 we changed the probing extension to small letter foo.dll. We realized this is a breaking change, and we change it back to capital letter foo.DLL in beta2.
Comments
- Anonymous
March 21, 2005
When using Assembly.LoadFrom(), the filepath/URL always seems to appear lowercase in the debugger output. Is this just 'display' normalization or some other rule regarding sensitivity applied? - Anonymous
March 21, 2005
The filepath is the path in your local machine. Case sensitivity is irrelevant there, since Windows file system is case insensitive. I don't think we (fusion) did anything there. Maybe someone else did the display normalization.
I don't know about the URL though. - Anonymous
March 21, 2005
Perhaps it's time for IIS to get case sensative... like the rest of the world... (perhaps a configurable option to turn case sensativity off/on?) - Anonymous
March 21, 2005
The comment has been removed - Anonymous
April 30, 2005
The comment has been removed - Anonymous
April 30, 2005
The comment has been removed - Anonymous
May 16, 2005
RePost:
http://www.yeyan.cn/Programming/URLCaseSensitivityAssemblyLoading.aspx - Anonymous
February 23, 2006
I discussed URL sensitivity issue back in March 2005 (http://blogs.msdn.com/junfeng/archive/2005/03/20/399418.aspx)....