Random Page not found error on asp.net application in IE6 - asp.net

Lately we are receiving complaints from users about Page not Found errors on production environment. This happens during Login page load or default page load in the asp.net application.
The application on the production environment did throw the Page not Found error. But when we tried to access the same application from test environment it worked without any problem.
I have read about client-side handling for form submission which results in a race condition with the form being submitted twice. IE 6 turns out to be especially vulnerable to this problem because of how it handles multiple connections to the same hostname.
I am unable to figure out what could be the issue because the application runs fine on other machines and only specific machines give this problem.

Try disabling the button after the first click, therefore blocking multiple clicks. Also have you tried replicating on production? Perhaps it is environment specific.

It was some machine configuration. The infrastructure team could not quite figure out what the issue was, but they formatted the machines which resolved the issues for the user. Not the best of solutions.
Logs did not indicate any detail.

Related

How to track intermittent issue with loading/non loading of web site in ASP.NET MVC 5

I am beginner in web development. And I am working in an ASP.Net MVC 5 application and stuck with a very weird issue.
Issue:
Sometimes my web site just won't load in the browser. When I run in the local dev machine, website loads properly (localhost). But in LIVE the browser will keep on loading the website but nothing would load.
Also
After half an hour or so, website again kicks back in and starts opening properly.
Action I took:
Sometimes restarting the WebSite from IIS fixes the issue, BUT NOT ALL THE TIME. Sometimes even restarting did not fix the issue.
Also, I checked the Chrome Debugger, I do not see any error there (when the website was not loading).
I know something called ELMAH exists. Or some error logging in IIS. Can some one tell me how can I track this issue, in step by step process. Why my website will keep on trying to load in browser but will never load But after some time it loads. Is it IIS issue?
KINDLY NOTE: Once it starts loding fine, then even if I close the website and reopens it, It opens superfast like a flash. So the hiccups comes sometimes only.
I am willing to put more details, in this question. but I am not sure what to put. as far as IIS is concerned, all I know is how to restart and stop my website. that's it.
EDIT
Step 1: So, I searched event viewer as a whole in windows search and found something like below.
Edit 3
I checked the windows log, I do not see any issue related to my web app.
I know something called ELMAH exists.
Elmah is alogging framework. With just installing the NuGet package you already have an effective error logging mechanism in place. All unhandled exceptions will be logged with all the related information. It provides a page to visualize your logs and you can configure almost everything from security, to different back-end storages.
If you need a cloud base error logger with more advanced features you can use elmah.io.
Take a look at this post for a step by step guide on how to integrate elmah.

ASP.NET Initial Load in Production - IPrinciple Isnt Set

I've got a situation that I'm a little confused by as I cannot replicate it on any of my other environments.
The site is still in development and therefore has practically no traffic other than the two of us working on it. So if the site is in a dormant state (all IIS instances closed etc) when I first log in the IPrinciple doesn't get set correctly (in time?) and so subsequent security checks obviously fail. I can then immediately go back to the login page, perform an identical log in and all is fine.
This also occurs irrespective of which user I test with so it's not specific to an account.
I can then log in and log out with any user accounts and this never occurs again. This never occurs in Development on my local machine and I also have an instance of the system in my local IIS instance I use as a faux staging environment. I only ever see this on an idle Production environment.
What can I do to prevent this situation from ever occurring? Is this also suggesting there maybe an issue elsewhere?
After having done a bit of experimentation it turned out that the problem was only manifesting in Google Chrome. All other browsers were performing as expected.
The solution was actually an oversight on my part. It seems Google Chrome has stricter rules around how cookies are dealt with in relation to domains.
Setting the domain attribute on the authentication cookie fixed the issue and now Google Chrome also logs in as expected.

Dev site creates session fine, production site doesn't

I have two sites running on the same server (IIS7 on Win2003).
Site A is my production site.
Site B is a development version of site A. Aside from connection strings in its web.config file, both sites are running the same code.
There are some session variables created in Session_OnStart in global.asax. I've noticed over the past couple weeks, Site A's session variables aren't being properly created. (These variables are used to populate a couple of dropdownlists) This causes the drop-downs not to auto-populate or other errors depending on the page the user is trying to hit.
Site B's session variables have been working correctly. When I hit Site B, the drop-downs populate as I expect.
The first thing I want to try is an IIS reset to see if this corrects the problem, but I'm wondering why my sessions wouldn't be created correctly if both sites are running the same code?
I figured out a solution but I'm still at a loss as to why this is happening.
I wound up coding defensively to handle the session variable I'm interested in not being properly initialized. When this happens I've got code that properly sets the variable. (In all the years I've been a .NET developer, this is the first time session has been an issue)
I can rule out most of the common causes - I know the session wasn't timing out, and I know no updates were made to web.config or any IIS settings (it's a production site, so nobody touches IIS without putting in a support ticket, and the only person who puts in support tickets for IIS is me).
This seemed to be a problem when users clicked on a particular link in the site. For some reason visiting this particular page caused the session variable to be lost. I'm at a loss to explain the why but at least I've got the code working and not throwing an exception anymore.

Losing Session information after publishing an ASP.NET Website on IIS

I'm a beginner in ASP.NET 2.0.Probably this could sound too basic and stupid issue for someone expert in the ASP.NET.But this is giving me sleepless nights.
Basically i have developed a simple multilingual website with a master page and content pages which fills inside the content place holder portions of the master page. The application works great when it is configured to run on the ASP.NET Development Server 2.0. But once i publish it to run on the IIS web server it will no longer function. :( I could see from the trace that none of the session variables i use are stored and redirected to the relevant content pages.
Although the contents are displayed, the session variable values by which i take some decisions on the redirected pages are lost and i run into exceptions.
Please guide me where am i going wrong and exact procedure for Publishing an application.
Ex: my home page has URL which runs something like
http://localhost/Onlineupdate/Home.aspx?vers=1.1&lang=fr-FR
Based on the above URL, i strip and save the vers and the lang variables in a Session variable. However these are lost when hosted on IIS.
There are a dozen or so things that could cause the session data to be lost:
IIS restarting
The app pool restarting
due to a change to the web.config
due to a change to anything in the \bin directory
memory limit reached, or a bug causing the app pool to reset.
several other possible causes
Your host is actually a web farm, and you're using in-process memory, which will cause issues when one server fails over to the other, unless you're using SQL Server session state mode.
Since we don't have enough information to answer exactly what's happening in your specific situation, I'd ask you to start by reading up, starting here: http://msdn.microsoft.com/en-us/library/ms178581.aspx
Edit: I did find this blog article, which may be helpful: http://blogs.msdn.com/b/amenon/archive/2007/08/21/troubleshooting-session-loss.aspx
The following is not necessarily part of the answer, but added to try to be helpful.
If it's feasible, from my own personal experience, we've had success in eliminating our lost session issues by using the SqlServer Session State mode. Since we implemented this, our session issues have all but disappeared.
also i found the main problem that you should initialize session before use
like:
session[“id”]=””;
and after that it well work fine
In order to prevent this to happen first in the web.config set restartOnExternalChanges to false.
Now in web.config changes must be propagated manually(this means that the dev is now responsible to build a mechanism for config change propagation).
Hint: You can use file watcher for this that will listen for the web.config (or any config you use in you web. app) for changes and wrap it as a watchable configuration so you can reload the configs when they are changed.
Hope this helps
I faced the same issue in my ASP.NET MVC website .
and i have resolve it by next steps :
open IIS Manager
go to the application pools
right click on the application pool which related to your website
click on "Advanced Settings"
set "Idle Time-out (minutes)" to be "20"
set "Maximum Worker Processes" to be "1"
Click Ok to close the window
these steps has resolved my issue.

Weird webpage loading behaviour

I have a website that I'm hosting on a public IP using IIS 7.0. (using c# asp.net 3.5)
I find that if I navigate to the webpage for the first time in a day. It loads endlessly and nothing shows up. Then when I re-press enter in the address bar, it loads right away and everything works fine.
From then on, when I got to the address again it loads quickly.
I don't think this is a compilation issue as all my code is pre-compiled.
Any ideas what might be causing this behavior?
Thanks!
Andrew
I had a similar problem which turned out to be caused by the IIS app pool recycling.
In my case, the website had outgrown its hosting package and as soon as it hit the arbitrary memory limit, the app pool was recycled and the application restarted, recompiling on the first page view.
You can check for this by adding a Global.asax and handling the Application_Start event. You could write logs to a database or send an email notification with whatever debug details you want.
I also handle Application_Error which offered up some useful info.
If you notice Application_Start happening several times a day, you may have a memory leak or similar issue.

Resources