Saturday, September 8, 2007

Viewing .aspx pages in IIS 6 using ASP.NET

Ok, this was super annoying, and it showed me that I don't know jack shit about setting up ASP.NET on IIS to work properly.

The problem I was having was trying to connect to MS SQL Server 2005 using ASP.NET. This did not work as I was getting HTTP Error Code 403. This pretty much means that you lack the permission to access whatever you are trying to access. In this case, I had created an .aspx file that will access SQL Server.

So after fiddling around for like an hour I tried accessing .aspx files in IIS first. Sure enough, I got an error. This time a bit more specific. HTTP Error 403.1 - Forbidden: Execute access is denied. After another hour of searching for an answer as to why my pages won't display, I finally found the answer, which made me feel really stupid.

In anycase, ASP.NET pages are a scripting language, they run code in the background that "talks" to the backend servers. Now, by default, all websites created in IIS having the scripting permissions taken off for security purposes. Well, that's the problem right there. Turn this option on and you are set.

Go to "Properties" of the website in question, click on the "Home Directory" tab, and change the option "Execute permissions" to "Scripts only" or "Scripts and Executables".

What a waste of time! Definitely feel dumb today.

No comments: