I've made a site with two pages: Login.aspx and Main.aspx. On the Login page I'm making a cookie containing information about the user, then with Response I'm sending the cookie to the Main page where I receive it and if it's not received I redirect the user back to Login. When I open the the website from Visual Studio everything works, but after I tried using it with Microsoft IIS as a localhost website, the page just can't change from the Login. Is it some option I need to set from IIS, or what I'm missing?
HttpCookie cookie = new HttpCookie("autorization");
Response.Cookies["autorization"]["name"] = name;
Response.Cookies["autorization"]["password"] = pass.ToString();
Also tried using ~/Main.aspx, ./Main.aspx, /Main.aspx, full path with http://ip:port/Main.aspx. I can access Main by turning off the cookie receive in Main and typing it manually in the url bar, but not by the code from Login (even without cookie).
Why it works on Visual Studio but not on IIS? What should I change to make it works in IIS too? Thanks.
I think it could be related to the retrieving of information from the SQL server through the Web server. I'm using the following string:
Data Source=.\SQLEXPRESS;Initial Catalog=master;Integrated Security=SSPI;
Tried with server:localhost, with ip\SQLEXPRESS, with Integrated Security to false. May be I need to set something in the SQL to allow the information to pass through IIS, since it's works only with the Visual Studio. With tracing the sql I saw that the site started with IIS connects and retrieve the information from the database, but may be it's not passing it through the IIS.
The problem was in the SQL and ISS ApplicationPool communication. I've changed ApplicationPool Identity as Local System and in SQL under Logins I've changed the NT AUTHORITY\SYSTEM permission to access the specific database through Server Role (or if needed only specific database access - through User Mapping). Now I returned the Identity to ApplicationPoolIdentity and I'm using connection string with username and password.