Few days back I was working on an ASP.NET website. The website uses custom formsauthentication. I had the login page under the root directory and other pages and images etc in separate folders. So the structure was something like this:-
Folder_Application Root
Folder_Pages
Folder_MasterPages
Folder_Images
Folder_Scripts
Folder_Controls
File_Login.aspx //Files
File_Web.config
Problem statement:-
After publishing the website on the server I was not able to see the Images which were present on the login page.
Solution One:-
I realized that I am using formsauthentication so I must allow anonymous access to the Images folder in order for the images to show up on login page. So I did that.
I was assuming that everything will be cool now. But it was not. As usual :) for we developers :).
But surprisingly things were working fine on ASP.NET internal server. This shows there is something wrong with the server and not the method. So I started looking into the IIS, but it was of no help. Then I thought of checking the IIS roles and services which were installed. I came across a service - Static Content. This service was not installed. It seems like the culprit. So I installed it and bingo. Everything started working as i wanted.
Summary:-
When using formsauthentication and if you have images on your login page, give anonymous access to your images folder.
While publishing website on the IIS web server do check whether static content service is installed or not. It will be needed.
To check the services installed. On windows 7 go to control panel -> add remove programs -> turn windows features on or off -> iis and on windows server 2008 you can check this using server explorer.
Happy Coding!!! Hope this will be of some help.
Comments
Post a Comment