Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
855 views
in Technique[技术] by (71.8m points)

asp.net - How to enable case-sensitivity under IIS Express?

How should I go about enabling case sensitive request handling if using IIS Express? Is there a setting in IIS Express? or can a URL Rewrite rule accomplish this? or perhaps catch-all HTTP Handler to do the case check?

The goal is to be able to catch case inconsistencies locally, with respect to static files, before deployment to both IIS and S3 (where S3 is case sensitive).

Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

IIS is case-sensitive...

...but not for files.

It is a misnomer that IIS is case-insensitive, it is the Windows file system that is case-insensitive, not IIS. If a URL contains a file path then IIS asks Windows if the file exists and the OS responds without regard to letter case. There is no way to "enable" case sensitivity for file names in Windows.

But for other than real file paths, IIS is 100% case-sensitive. The case of URL characters is passed to the IIS pipeline intact. It is up to the web application whether or not case-sensitivity exists. But good practice says you don't want /page1 to be different than /PAGE1.

ASP.NET is case-insensitive to query string variable names. AGAIN, this is not IIS. It is the application (ASP.NET) that is case-insensitive.

Summary

Static file paths are not case-sensitive (due to Windows OS, not IIS):

http://example.com/sUbdiRectoRy/FILe.aspx

HOWEVER, portions of the URL not participating in the file path are case-sensitive (everything after file.aspx below except for the 'x' parameter because .aspx is an ASP.NET resource):

http://example.com/sUbdiRectoRy/FILe.aspx/Extra/Tail?x="query parameter"

URLs that are dynamically generated by re-writes, HttpModules, etc. are also case-sensitive if the application is case-sensitive. This is usually not best practice as these two URLs would refer to two separate web pages:

http://example.com/2012/01/23/blog-article
http://example.com/2012/01/23/BLOG-ARTICLE

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...