TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sunil meena
NA
12
944
How to hande errors in multi user application in C#?
Dec 6 2016 2:19 PM
Suppose in an application at a time multiple users are online. And because of some reason 4 users got exceptions. As we have global exception handling implemented in our Global.asax file, so we show a custom error page to all the user and log the error using below code:
var currentException = Server.GetLastError();
logger.LogDetails(currentException);
// some logging code
Server.ClearError();
User 1 got Divide by zero exception.
User 2 got invalid cast exception.
User 3 got Index out of range exception.
User 4 got some Sqlexception.
What will this Server.GetLastError() return in this case?
Also, I need to log the exceptions. So think of it as, I want to log exception based on user as key and Exception details as description. So for User 1, there will be a log entry something like User=U1, ExceptionDescription="Divide By zero".
I'm worried that GetLastError will return whatever error occured last regardless of user, and if four users get an error there could be crosstalk and they could see each other's errors (or the logging code may log the wrong user name with the wrong error).
I can get current user using HTTPContext but still not able to get exception that is occurred in their session. How can I achieve this?
Reply
Answers (
4
)
could not understand lines of code after decompiling a dll
How get maximum 3 values of unsort array without max functio