IIS Windows Authentication does not work with Webmatrix / Razor CSHTML - asp.net

I need to use IIS Windows Authentication instead of Anonymous so that I can get the visitors username. The server and all the pages are on a local domain and all visitors are logged into the domain. The problem I am having is that Windows Authentication does not work with Webmatrix pages.
On IIS we just have one site and there are various pages and sections. Some are ASPX and now we also started creating CSHTML with Webmatrix/Razor. When enabling Windows Authentication and disabling Anonymous, any page that you try to load (ASPX, CSHTML, etc...) automatically redirects to /Account/Login?ReturnUrl= which does not exist and results in a 404 error.
I don't know why this happens.
Windows Authentication worked fine before the Webmatrix files were added.
I have tried numerous suggestions and nothing has resolved the issue.
I found several posts online saying that there maybe a bug in Webmatrix and that the WebMatrix.Data.dll and WebMatrix.WebData.dll are causing the issue. So just as a test I deleted these files from the Bin folder and right away the ASPX files started to load fine and authentication worked OK. Problem is that without these DLL's none of the CSHTML pages work which is what we really need.
Is there a fix for this? Removing the DLL's I mentioned is not an option for us since it breaks the most import functions which is querying and displaying data from SQL but at the same time I really need Windows Authentication to work with Webmatrix and CSHTML because we need to know who is using the pages and its impossible when IIS is running in Anonymous mode.

Related

Deploying a Web Site project did not work

I was Working through Microsoft's example on Deploying a Web Site Project. As the example suggested, I used the tool to place the compiled website in a local directory, and then creating a virtual directory in IIS and pointing it to that directory. Then I converted the virtual directory to an application. I tried browsing to the local website (http://localhost/TestSite03/SamplePage.aspx) but got an error that it could not access the config file due to permissions. I read this post and decided that I should add IIS_IUSRS to the site. I did this by right clicking on TestSite03 in IIS Manager and choosing "Edit Permissions". After that it just stopped working. The browser would spin when I went to the site, and eventually display a 'page not available' page. Same thing when I go to http://localhost now also. I tried removing the application, but localhost is still not working. I did look at other values while I was trying to get the TestSite03 working, but I don't think I made any other changes. Anyone know what I might have done wrong here?
Things I tried for localhost not working:
Reordering the default page configuration.
Restoring the default page order to inherited value.
Adding a default.htm page.
Making the directory browsable.
Restarting the Default Web Site
Rebooting the computer
Checking permissions
-
Possibly Relevant info:
Windows 10,
Visual Studio 2013
.Net Framework 3.5 used for the test site
Chrome and edge browsers.

Why a 404 on every available page on a Web Site project?

I've just opened a Web Site project found on my predecessor's machine and - I hate the things and don't ever work with them - I get a 404 on every link I click, while the page is definitely present. If I directly view the individual page in the browser, that page works fine, except for any links on it to other pages.
It's like the built-in dev web server isn't operating and interpreting URL requests, but I have no idea where to look to clear this up.
USING IIS: If I create and deploy this site under IIS, everything seems to work normally.
MY MAIN QUESTION IS: Why do pages get not get served on this site and do get served on similar sites, under debugging a Web Site project on VS2012. It is not how to solve the problem by deploying to IIS.

ASP.NET pages not loading on IIS8 (Windows Server 2012)

I am trying to set up my Windows Server 2012 to run an ASP.NET website. The website can serve html pages and .svc pages, but whenever I visit an .aspx page, it will simply time out.
Error 118 (net::ERR_CONNECTION_TIMED_OUT)
If I would at least get some sort of error description, I could go from there, but I just get a timeout message, as if the server is completely unavailable, so I am stuck with this problem.
It seems the aspx pages are not loaded at all, since I've already tried drastic measures such as putting a "throw Exception" in the first line of Page_Load.
If I create a new site and put just an aspx page in there, it executes fine.
The Event Log is not showing anything in relation to this.
Does anyone have any suggestions?
Creating a new web site in IIS8 and pointing to the same folder made it work. Now the site is working fine and running code as normal.
My guess is, that if I created the website before installing all needed features, they were not part of that site. Now, after installing a new site, it contains all the current features.
It doesn't make TOO much sense, though, as the server had ASP.NET 4.5 from installation (it's Windows Server 2012).
Open up the Web Platform Installer.
Now look for IIS: ASP.NET 4.5 and install that.
I had the same problem as everyone else and nothing worked until I did that.
There is a difference between installing dotNET on your computer/server and dotNET for IIS.

Request for Sitecore page returns IIS 404

I request a page in Sitecore and I get a 404 from IIS. The site works on my development environment & staging. This is on the production machine, which is a new install. I've never actually seen it work. The fact that it's giving me an IIS 404 (instead of a Sitecore 404) seems to indicate that whatever handler Sitecore uses isn't being recognized or isn't set up properly. I'd appreciate any suggestions about where to begin looking or what the issue might be.
We're in II7 running in classic mode.
I have the same issues if I run Sitecore in classic mode. Why don't you try running in Integrated mode, for all handlers to work propperly? Your Sitecore login page works, so that indicates that you have unzipped the Sitecore folder corretly. I'd suggest you to try Integrated mode.
It sounds like a permissions issue, check that Network Service (or Application Pool Identity) has the correct access to all of the Sitecore folders.
This looks like a fairly good guide on this:
Sitecore folder & IIS permissions
You could also try exporting the IIS setup for production and staging and comparing the two to make sure nothing odd with the setup.
Have you tried running the installer? If you are cleaning up someone else's install, there's no telling what they did... far easier to start again. You can easily connect to an existing database, or install a package with all your content once you've got a good working Sitecore instance.

Sitefinity, IIS 6 WCF services return home page

I'm evaluating Telerik's Sitefinity CMS. On my dev box (Win7 x64/IIS7), everything works great.
However, when I deploy the site to our Win2k3/IIS6 server, the backend system doesn't work correctly. According to fiddler, anytime the browser makes an AJAX request to a WCF (.svc) service within the application, the home page is being returned.
Any suggestions?
I've tried:
re-registering ASP.net
Re-registering WCF with
\windows\microsoft.net\framework\v3.*\wcf\servicemodelreg -i
Made sure that the .svc extension is allowed
Deleted and recreated the site in IIS
Argh. Suggestions?
You can find installation information and other tips on getting Sitefinity up and running by visiting the documentation.
This turned out to be related to the IIS6 application pool identity, permissions on the web folder, and having multiple authentication methods checked in site properties. By playing with those things I was able to get it to work.
As a test, I ran the site through the Sitefinity project manager app (using its integrated Cassini server), and everything worked correctly.

Resources