How to enable case sensitivity in IIS Express?

How can I enable case-sensitive request processing using IIS Express? Is there a setting in IIS Express? or can a URL rewrite rule do this? or perhaps the whole HTTP handler for checking a check?

The goal is to locally remove inconsistencies in the case of static files before deploying both IIS and S3 (where S3 is case sensitive).

thanks

+4
source share
2 answers

IIS is case sensitive ...

... but not for files.

It is not true that IIS is not case sensitive, it is a Windows file system that is case insensitive, not IIS. If the URL contains the file path, IIS asks Windows if the file exists, and the OS responds regardless of the case with the letter. Cannot "enable" case sensitivity for file names in Windows.

But for others other than real file paths, IIS is 100% case sensitive. The URL case is passed to the IIS pipeline unchanged. Regardless of whether case sensitivity exists. But good practice says that you do not want /page1 different from /page1 .

ASP.NET is not case-sensitive for query string variable names. AGAIN, this is not JIS. This application (ASP.NET) 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 a URL that are not involved in the file path are case sensitive (everything after file.aspx lower, 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 when re-writing, HttpModules, etc. also case sensitive if the application is case sensitive. This is usually not the best practice as these two URLs refer to two separate web pages:

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

As Kevin Rice has already pointed out, this has nothing to do with IIS. This applies to the file system, file system driver, and /asp.net operating system.

The default file system for Windows 2000+ is NTFS, which is not case sensitive. You need a case-sensitive file system, so you should look for a file system driver for case-sensitive windows.

Regular Linux file systems by default (called ext2 / ext3 / ext4) are case sensitive. And you can find a Windows driver for them: http://www.ext2fsd.com/

All you have to do is put your application on this file system and configure IIS to run the application from there (you might want to install Linux with dual boot so that you actually have an ext4 partition on this computer - be careful if you do it wrong, your data may be GONE).

What bothers me more is that the S3 file system is case sensitive.

This is very bad if someone mistakenly uses your url, or if the search engine is lowercase, you get 404 ...


May I suggest that instead of looking at how you can make windows be case-sensitive, you can see how you can make S3 become case-insensitive, which is probably the best approach.

I really don't know how to do this on S3, since I don't know S3.
However, I know that Linux (which probably uses Amazon S3), so if you can create your own file system, at the bottom of my post here , you will find (commented) ways to do this.

In a nutshell, you create a .dsk file of the required size of X bytes (X = count * blockize), format it using a case-insensitive file system (vfat, jsf, hfsplus) and connect it to / mnt / independently.

Then you put your web application in / mnt / whatever and configure the root directory for the web application.

Note that if you omit -O in JFS, it will be case sensitive.

 apt-get install jfsutils dd if=/dev/zero of=jfs.dsk bs=1048576 count=150 mkfs.jfs -O jfs.dsk mkdir -p /mnt/jfs mount /volumes/jfs.dsk /mnt/jfs -t jfs -o loop umount /mnt/jfs/ 

or how it is with hfs-plus (better performance, HFS: high-performance file system)

 sudo apt-get install hfsprogs sudo modprobe hfsplus sudo dd if=/dev/zero of=hfsplus.dsk bs=1048576 count=150 sudo mkfs.hfsplus /volumes/hfsplus.dsk sudo mount /volumes/hfsplus.dsk /mnt/hfsplus -t hfsplus -o loop umount /mnt/hfsplus/ 

In addition, if you do not want (or cannot) install anything, vfat is usually installed by default:

 mkfs -T vfat /volumes/vfat.dsk 

In addition, Linux distributions (such as S3) created by Red Hat do not use apt-get, they use rpm / yum.

And if you want the file system to be permanently mounted, you need to add /etc/fstab : https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Introduction_To_System_Administration/s2 -storage-mount-fstab.html

or you can add a launch script that mounts this particular file system every time you reboot / boot the system.

+1
source

Source: https://habr.com/ru/post/922271/


All Articles