I have an MVC 3 application which I have been developing, which uses Forms authentication. In my web.config file the only authentication code I have is:
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
I then use the [Authorize] tag on each individual controller I need to restrict access to.
I run the system on my development machine (Windows 7), an online demo server (Windows 2003 with IIS6.5) and a local production server (Windows 2008 Web Edition R2 with IIS7.5).
When I access the system on the Win2008 server, I am redirected to the login page as expected, however none of the CSS stylesheets load, and all images are missing (all located in the Content folder). This only occurs on the Win2008 server, on my local dev machine and on the Win2003 machine, the CSS and images load just fine.
There are no restrictions on the Content folder, in fact it even contains its own web.config explicitly allowing access to non-authenticated users. I have also tried adding a line to the main web.config allowing full access to Content.
If I place a .htm file in the Content folder, I can access this in the browser. If I try to access an image or a .css file however, I am immediately redirected to the login page!
I am stumped as to what may be causing this.
As mentioned by Wim, the duplicate thread has the answer (although in the comments to the accepted answer in my case).
The problem is caused by the Authentication settings in IIS Manager.
Select your site, then select Authentication. Ensure both Anonymous Authentication and Forms Authentication are both enabled.
In my case, I also had to change the anonymous user - to do so, right click Anonymous Authentication and select Edit. Change it to Application pool identity.
After this, the images and styles load perfectly!
Related
we are working in customizing login page from AD FS en Windows Server 2012 R2
Changes work correctly in a local navigator, but when load changes to server, we don't see any image and some fonts fail too.
It's just to know if anyone has really make a great change in login page only changes CSS file.
https://learn.microsoft.com/en-us/windows-server/identity/ad-fs/operations/change-the-company-logo-on-the-ad-fs-sign-in-page
There are a whole lot of tips and tricks described at ADFS : Continuing the Login and Home Realm Discovery (HRD) and Change Password customisation adventure.
The css specific reference is here.
ASP.NET + MVC 3 + IIS7.0 + HTTPS requests
In short how do I setup HTTPS requests in IIS7.0 (NB: I am not using IIS express). Ideally only for the events in my AccountController is all I need but I can come back to that. I have read up on a few posts and I getting to understand them however I guess I just need direction as I am not sure what is going on. What I have done is as follows:
Web.Config:
<authentication mode="Forms">
<forms name="MyMVCAUTH" loginUrl="~/Account/LogOn" timeout="20" protection="All" requireSSL="true"/>
</authentication>
In IIS7.0:
Created a new website by adding the path to my code and used the DefaultAppPool
I edited the permissions and added IIS_IUSRS user with "read & execute"
Changed the DefaultAppPool to use the latest .NET framework
Created a new Self Signed Certificate and added a https binding
My "Default Web Site" which was pointing to port 80 I stopped and applied the default ports of 80 and 443 to my new site.
Ran my application thru VS "MS Visual Web Developer 2010 Express" with debug=true and removed an offending line of targetFramework="4.0" which it did not like. However, clicking on my [Log On] link my CSS styles have been removed!?!? Do I need to specify the port number via VS some how? Via VWD it chooses a random port number and when you click on the hyperlink it removes the port number?
Since you have created a self signed certificate, IE doesn't recognize it coming from a valid certification authority and it warns you about when you navigate to the website. You could ignore the warning by continuing to the web page. The same ting happens with your CSS and javascrpt links. So here's what you could do: Copy-Paste the link to your CSS and JS files into the browser address bar (with HTTPS) and ignore the warning. Then refresh the actual page (Ctrl+F5) and the styles should reappear.
I locally designed my site. Then exported MySql database as Sql file and executed the scripts in the real server. Also copied the joomla directory to the server.
Now, I am getting strange 302 redirection errors in my web site, when I am accessing the home page. However, I am able to login into the admin panel. I can see all my contents available.
The redirection happens to the same page, i.e. continuous requests are issued to the index.php/en/ (checked using fiddler).
Am I missing any configurations?
Regards,
Well this is tricky without a link to the site to see the behaviour in person, but it could be that you forgot to upload a .htaccess file or set the Redirect Base or cookie path/domain in the configuration.php (if it's empty then it's probably not a problem, only if you have manually edited it).
I have two applications setup in IIS7.5. MVC 3 is installed. One application serves Razor files fine. A separate application was recently created that will not serve Razor files. I get the following error when accessing the file using the full filename (file.cshtml):
This type of page is not served.
Description: The type of page you have requested is not served because it has been explicitly forbidden. The extension '.cshtml' may be incorrect. Please review the URL below and make sure that it is spelled correctly.
When trying to access the file without an extension (/path/file/) I get a 404 error.
I have searched for this problem but haven't found a solution where it works with one application but not another on the same server.
Both applications are using the same App Pool.
Web.Config files are identical.
Do both sites have a CSHTML file in the root of the application? Since the WebPages framework (which is what is used when you request a CSHTML file directly) has a significant impact on your site's performance if you aren't using it, we only start it if there's a CSHTML file in the root folder of your site (i.e. ~/Foo.cshtml). If you don't have any CSHTML files in your root, you can also add a web.config entry to set an appSetting:
<configuration>
<appSettings>
<add key="webpages:Enabled" value="true" />
</appSettings>
</configuration>
If you're confused by my answer, it would help if you edited your question to add information about the file layout of the two apps. Then I can add some concrete examples to try and clarify things :).
Hope that helps!
I am have a web application on local IIS (mylocalsite.com)
What settings I need, so that I can handle all subdomains of my local site, like
user1.mylocalsite.com
user2.mylocalsite.com
anything.mylocalsite.com
All urls will point to same index page from where I can seperate subdomain and load page accordingly.
Since your description is not that clear, my initial thought would that you can setup different Bindings in IIS to cater for all the subdomains.
In IIS 7, right click your website -> Edit Bindings -> Add..
But my guess would be that you may need to do this from code, since users are added to your system (assuming user/sub-domain model). For this I refer you to
Create Binding in in IIS (iis.net)
Cool new IIS7 Features and APIs - ScottGu
Microsoft.Web.Administration