I have a very simple asp.net mvc4 application with Windows authentication enabled and deployed to IIS7. This application is then accessed via a Sharepoint Page view Web part.
The web application itself consists of a single controller, model and view with an Html helper Ajax form. The applcation itself works fine, without problems.
I used the standard internet template and deleted all the other views, models and controllers. I have not deleted any of the script files as I am not sure which ones are safe to do so.
I have configured windows authentication in the project's root web.config:
<authentication mode="Windows" />
<identity impersonate="true" userName="domain\serviceaccount" password="pw" />
In IIS all authentication types are disabled except; Impersonation and Windows Authentication.
As you can see, I have removed the
deny users = ? section because when it is included the problem occurs all the time.
The problem is with the authentication, when I run it locally in debug mode it works fine. If I deploy to IIS locally it works but I have to navigate there a few times before it does. Also other users are also able to access the site hosted on my machine but also need to navigate there a few times.
It also works in Sharepoint but I will need to navigate there a few times as well, but remote users don't seem to be able to access it at all.
When it does not work, it seems to be automatically redirecting to a non-existent login.aspx page. It should not need to do this because this site is only accessed from inside the domain and all users are already authenticated.
When I deploy to a remote server, it does not work at all. But that seems to be a completely seperate issue regarding a referenced library's dependencies and it fails to load the assembly. This is not the question/concern though. Well yet :)
Edit: By 'navigating there a few times', I mean. In the browser I enter in the URL (ie. http://host/webapp). If visiting for the first time it usually fails with a 404 error and the url in the browser has changed to 'http://host/webapp/login.aspx'. I then delete the 'login.aspx' part and hit enter. It might fail again, so I repeat the process. After two to three attempts it works. Within Sharepoint I can just click a link to go to the page. The first time I click the click, it probably won't work, click it again a few times and after two to three attempts it works.
Assistance is appreciated, and thanks in advance.
Let me know if you need more info.
Keith