Does running a HTTPModule prevent IIS Logging? - asp.net

We are running a site using a custom HTTPModule to do some URL Routing.
The problem is this sites traffic is not being logged by IIS.
Everything appears to be set up correctly, and other sites on the same server are logging. But the log folder for this site remains empty. (not even the W3SVC... folder is being created!)
Is this related to us running a HTTPModule, or is something else causing the problem. I can't find anything that says it would stop logging, or anything that says it won't.

In a word, no. You've got something else funny going on. Are you absolutely sure logging is enabled and you are looking at the correct path?

Related

How do I find where a redirect is occurring on my website

We're moving an instance of a third party, .NET-based website to a Win2016 server, IIS 8, from an external hosting service. Under the site, there's a WCF web service in a subfolder. There are no virtual directories or apps.
mysite.../Order/v4/service.svc
When I browse to pull the wsdl (https://MySite.../Order/v4/Service.svc?wsdl ), it is redirecting to Login.aspx (https://MySite.../Order/v4/Login.aspx).
Browsing to https://MySite/Order/v4/Service.svc?wsdl redirects to https://MySite/Order/v4/Login.aspx .
IIS has no default document set / web.config's defaultDocument is commented out.
Vendor indicates
That would be a redirect that was setup either on IIS or another
appliance that is doing that.
Same behavior occurs running on the server itself (localhost) and sys eng confirms it shouldn't be leaving the network to hit any firewall.
There are no other .config files on the server with any reference to "Login.aspx".
This still feels like it is some piece of configuration but even doing things I shouldn't need to do like restarting the server just to make sure no caching of settings is hanging around isn't affecting it.
Any guesses on what might be attempting to redirect?
Following Rich-Lang's suggestion in comments provided the information to identify that the global.asax file was handling an error in the web.config. Since the code in this case was in codebehind in a dll, and the vendor indicated their code does not redirect, I had not seen that culprit before. Removing the global.asax and turning off customErrors allowed me to see the underlying issue.

Hidden redirect on IIS site?

We have an ASP.NET webforms web application running on IIS 6. There is a permanent redirect in place, for one of its pages: https://www.deurengigant.nl/content/voorwaarden.htm to https://www.deurengigant.nl/content/voorwaarden.
This redirect isn't happening on our local testing version, nor is it happening on a live test version, using the exact same code (including web.config, which has the database connection string): http://test.deurengigant.nl/content/voorwaarden.htm. (Yes, we don't have https on the test version.)
I've already checked the URL rewrite section in IIS Manager for the web site, but there is nothing there. (Pretty sure it simply shows what's defined in web.config rewrite rules anyway.) The HTTP Redirect section shows nothing either.
I've gone through the code looking for redirects, but couldn't find the problem there; also, the test version and our local version use the same code folder.
I've also checked the URL in a Chrome incognito session, to make sure the permanent redirect isn't pulled from cache.
What could I have overlooked? Where else could the 301 Permanent Redirect be set up?
The redirect is in applicationHost.config, which is located in C:\Windows\System32\inetsrv\config.
I think it's unwise to put it there, since that file is usually not in source control, nor copied to developer machines for local debugging.
As for why the test version on the live server doesn't have the redirect… I still don't know! They both use applicationHost.config, so they should have them both! That said, check the "error pages" section of IIS Manager. For me, it gives an error for the test version, stating: "cannot add duplicate collection entry of type 'error'". This refers to the error nodes in the httpErrors section of web.config and applicationHost.config, so I think it might be related to that. Maybe a nice conundrum for a rainy day.

in IIS 7 add site specific error page settings

I'm trying to setup a classic ASP page to log errors by redirecting the errors to error page that has logging enabled. When the site was migrated from IIS6 to IIS7 the logging stopped working as the details of the errors are not included in the redirect.
I have been able to fix this issues somewhat by going to the site in IIS Manager, going to that sites Error Pages, Clicking Edit Feature Settings, and Changing that option to Detailed errors for local requests, setting my default path to the error page, and changing the path type to execute URL. In order to do this I had to edit the apphost.config and remove some of the locks that are in place there.
Now when I go to other sites on my IIS the same default page path is set on those too. can someone please point me to some documentation or tell me how to make this change only for this particular site?
TO do the error page per Website Deployed in the IIS you need to click on individual website and then on right hand side click on Error Pages and select the Page.
My problem ended up that I was editing my applicationHost.config which would seem like a reasonable solution, but alas it was not. Changing that XML seems to have no effect on what the IIS manager would allow me to do. I finally went into the Configuration Editor for the root of IIS and edited the same settings there, which actually had some effect. All that I had to do at that point was remove the attribute lock on default path and the then I was able to edit my site. I have no idea why changing the application host did not have any effect. I would make the change and when I finally looked in the settings in the IIS manager, nothing I had done was changed at all... FYI this is IIS 7.5 on Win7
Hope this helps someone else.

Credentials prompt for an aspx page configured for anonymous authentication

From Flex we call a Upload.aspx page which is configured for anonymous authentication. Most of the time, it works like a charm, but once in a while, the browser does prompt a enter credentials popup...
The whole site is configured for Windows Authentication, but some pages and folders are set to use anonymous authentication. This is done using the location tag in web.config.
What could be the reason for this?
UPDATE:
Only happening in Internet Explorer... they should deport it.
If you use FireFox with FireBug, open up the Net panel, it will show you the request making the permissions request. If you cancel it, it will show an access denied in red, and that will easily help you hunt the issue down.
Maybe it's because a file (image, css, etc.) is being referenced that doesn't exist?
A couple of things I would check out:
Are there any images/other files that are added to your page using the FQDN? If so, are any of these pointing to an external site or staging site that might require credentials?
Is it possible that someone has removed permissions from the application pool credentials on the web server for some specific file or files the site is requesting?
Is the site load balanced or part of a farm? It could be that one or many servers are configured incorrectly, and the rest are ok. Then if by chance you hit the bad servers, you could get the prompt.

500 - Internal server error for ASPX page

I have created one test.aspx and my local machine it is working fine. Once I upload the same to server the page is not working. It's showing
500 - Internal server error. There is a problem with the resource you
are looking for, and it cannot be displayed.
It is impossible to help you without getting more info about the IIS configuration on your local machine and the server.
However, here's a quick stab of some things you should look at:
Check if Asp.net is installed on the server.
Make sure your app is targeting the proper .Net version that is on the server.
Check if all the assemblies your code is using are deployed correctly on the IIS server.
Add some exception handling and error logging to your code.
In particular, I'd venture to make a wild guess that your page is using some code that requires the IIS7 integrated pipeline and your server is either running IIS6 or is running IIS7 in classic mode. Though this is a stab in the dark and could turn out to be completely wrong. :-)
500 server errors are as useful as saying 'something broke'. They are the result of literally any exception you code throws plus anything else IIS croaks on. From your error msg, it sounds like an IIS config issue but it could still be your code. attaching a debugger to it would eliminate that possibility.
If you haven't looked at the server event log you can see if it registered anything.
There are a number of things that you can do to try to get a better, more specific exception. One way I try to diagnose them is to connect a remote debugger so I can see what's going on. If you have access to do so, I'd go that route.
You will need admin access to the server to install the Visual Studio remote debugging client (I'm assuming this is a .net app).
Another thing that can help are try/catch blocks and logging to a file or the event log--but have have to change your app most likely to implement that.
You have probably forgotten to upload the associated .dll. Have you tried right clicking on the project and using the publish feature?
If you are using IE, then you also need to turn off the "Show friendly error messages" option in Tools - Options - Advanced settings so that you get more details.
You may also need to change the web.config file so that error message details are shown, see the CustomErrors tag.

Resources