Form authentication works on dev server but not on IIS - iis

We have a similar problem. We have a web application running under default appdomain. It was working fine until a week before...Suddenly it has encountered a problem. Below message is taken from event logs.
Event code: 4005 Event message: Forms authentication failed for the request. Reason: The ticket supplied has expired.
Application uses FormsAuthentication and gets the roles from aspnetdb.. After the error, when user logins to the page, it does not redirects to the default.aspx. Again login.aspx comes up. On the other hand application works fine on development server(localhost), but not on www(IIS 6.0).
Does any one has an idea?
Thanks,
İlknur

It looks that when Application Pool your app is running on is in Integrated Managed Pipeline Mode, which is default under IIS 7, you will need to add
<system.webServer>
<modules>
<add name="FormsAuthenticationModule" type="System.Web.Security.FormsAuthenticationModule" />
To configuration.
Please refer to [Performing Forms-Based Authentication and URL Authentication on Static Files with IIS 7] section from this article
Initially I added aforementioned section to web.config by hand, but IIS complained with runtime error, so I ended up using MMC panel for IIS (inetmgr) to add it via GUI. Application's config file wasn't modified, but feature started to work, so I'm not sure which configuration file GUI tool applied the change to.

Related

HTTP Error 401.2 - Unauthorized with Error Code 0x80070005 with both IIS ans IIS Express

After attempting to configure IIS as a replacement for IIS Express, both stopped working and delivered the above error on deploying the .NET Core project in VS2019. According to IIS anonymous authentication is enabled, I also entered explicit user name and password as well as giving my user all rights to work with the project's directory. I restarted the IIS several times and re-created the pools and Pages, as well as repairing VS2019 in hope to get the IIS Express running again at least.
I have no idea what else I could do.
EDIT: I am using IIS10
Module
IIS Web Core
Notification
AuthenticateRequest
Handler
aspNetCore
Error Code
0x80070005
Requested URL
http://localhost:12345/
Physical Path
C:\inetpub\...
Logon Method
Noch unbestimmt
Logon User
Noch unbestimmt
You can try the following steps to solve your problem:
Right click on the project, go to properties.
Select the web, and then you will find a service setting
Change the project URL for other port, like http://localhost:44338/.
I was able to figure it out myself by now:
For some reason during setting up the IIS and IIS profile (accidentally or by some quirk of VS), the anynomous authentification setting was set to false. Which also affected the IIS Express to not work properly anymore. Simply enabled anonymous authentication resolved the issue for both.
Project Properties -> Debug -> IIS profile -> anonymous authentification: ✓

IIS returns error code 403 in response header and no error page

My setup:
Windows Server 2012
IIS 8.5
SharePoint 2013
The SharePoint site is configured to requeire client certificate. If the user has no valid certificate or the password was wrong IIS returns error code 403 in response header. I would like IIS to return a custom error page instead where I could guide the user how to fix the issue.
There are just to many options where I can configure error pages. Which is the right one?
In IIS I have three possible sites to configure.
Default Web Site
My web application
My web aplication port 443
Custom errors in web.config
Error Pages in IIS
.Net Error Pages in IIS
I have tried some of these options but with no success. Can anybody help me?
Just edit the web.config file in your Visual Studio solution, modify the customErrors section and then check the file into Github to trigger a new deployment.
If you don't use VS, then find your web.config file. Worst case scenario you can edit it directly.

ServiceStack always Default Redirect to /metadata even when Default.cshtml present

I have a ServiceStack project with ServiceStack Razor added. Any time I try and navigate to the root of the site, I'm getting redirected to /metadata.
This does not happen on my dev machine, only in my hosted environment (AppHarbor).
I do have a Default.cshtml in the root of my project.
Navigating to other URLs work fine: /default1.cshtml, /myservicewithviews
I've tried messing with the DefaultRedirectPath in my AppHost, but that didn't help.
Trying to force it DefaultRedirectPath = "default.cshtml" result in a redirect loop. Which makes sense.
What is causing this?
AppHarbor only publishes files marked "Content" when building projects (AppHb FAQ). This file was the only one not marked content and why I was only experiencing this in my hosted environment and could access all other content.
Not detecting a default document causes ServiceStack to set a RedirectHttpHandler to /metadata - shown around here
Another noteworthy point is that AppHarbor's load-balancer causes their internal port numbers to show up in ServiceStack URLs when performing things like Response Redirects.
To fix this problem, you add the following to your Web.Config:
<appSettings>
<!-- AppHarbor Setting to stop AppHb load balancer internal port numbers from showing up in URLs-->
<add key="aspnet:UseHostHeaderForRequestUrl" value="true" />
</appSettings>
You could also configure this setting in your AppHarbor config panel.

ASP.NET 4 Returns a 500 error

I have an ASP.NET 4 page returns a 500 error. This is a single page with a single Response.Write command:
<% Response.Write("Hello World") %>
IIS 7.5
The website's permissions are:
SYSTEM
MACHINENAME\myusername
MACHINENAME\Administrators
MACHINENAME\Users
MACHINENAME\IIS_IUSRS
The Physical Path is:
C:\Users\myusername\Documents\mywebsite
The permissions on the physical path folder are:
SYSTEM
MACHINENAME\myusername
MACHINENAME\Administrators
MACHINENAME\Users
MACHINENAME\IIS_IUSRS
The application pool is set for .NET Framework v4.0.30319 using managed pipeline mode: Integrated. Classic mode has been tried as well.
The web.config file contains the following lines:
<authorization>
<allow users="*"/>
</authorization>
<compilation debug="true" targetFramework="4.0">
<assemblies>
</assemblies>
</compilation>
IIS Authentication is set to Anonymous Authentication - Enabled
Physical Path > Test Settings shows the following warning:
The server is configured to use pass-through authentication with a built-in account to access the specified physical path. However, IIS Manager cannot verify whether the built-in account has access. Make sure that the application pool identity has Read access to the physical path. If this server is joined to a domain, and the application pool identity is NetworkService or LocalSystem, verify that <domain>\<computer_name>$ has Read access to the physical path. Then test these settings again.
I have tried everything that I have read to fix that, but nothing changes the outcome of a 500 error
Single log entry:
2012-03-22 19:24:16 172.16.35.115 GET /Default.aspx - 80 - 10.1.11.107 Mozilla/5.0+(Windows+NT+6.1;+WOW64;+rv:11.0)+Gecko/20100101+Firefox/11.0 500 21 13 203
This is new for me, I never spent this much time getting a web page to load.
I also added the ISAPI filters for the 4.0 library, both 64bit and 32bit versions.
Can anyone help?
UPDATE
All research leads me to think that there is a problem with the way that ASP.NET 4 is registered with IIS, and that the aspnet_iisreg utility should be run again. Unfortunately, I don't yet have permission to do that from the admin.
I had the same problem with IIS 8 on windows server 2012.
Enabling ASP.NET 4.5 in the server features resolved the problem for me.
Do you get any error information displayed with the 500 error? I'd also check the Event Viewer on the server as errors are also logged there (in the Application log - from memory).

IIS FTP 7.5: Custom Auth Provider not working Error 530

I have recently install Server 2008 R2 on a new server and want to use the FTP capabilities that are now shipped with IIS 7.5.
Since my users are not windows users, I was using IISAuthManager but this prodiver does not offers home directory on a user basis.
I found this sample http://learn.iis.net/page.aspx/669/how-to-use-managed-code-c-to-create-an-ftp-authentication-provider-using-an-xml-database/ to get going with a simple xml based user config. But i can't make it work. It's always gving me
Response: 530-User cannot log in.
Response: Win32 error: The system cannot find the file specified.
Response: Error details: An error occured during the authentication process.
I used procmon to get if the xml config file was read with no luck. I don't even think my assembly is being used.
Anybody ever had the same issue ? Basicly, any tips would be apreciated.
The IIS FTP custom providers are a nightmare to debug. In this case sounds like a config error, check that you followed the set up instructions (or manually checking applicationHost.config). Or post your code (inc config) if you still need help.
Barry
IIS Manager > Your site > FTP Authentication
Probably, you have all Basic and Anonymous Authentication disabled.
One of them should be enabled.

Resources