I have a project mvc4 web application. it is a chat application where users authenticated to chat in private room and can be not authenticated for public chats.I have elmah.axd package in my project to log all errors and it logs the "The connection id is in the incorrect format." error from signalR, every time user authenticated LogIn and LogOut. is there a way to catch it and not log it ?

有帮助吗?

解决方案

You tagged Elmah as your error reporting tool, so:

https://code.google.com/p/elmah/wiki/ErrorFiltering

To add an exception filter programmatically, put the following in your Global.asax file (or in the code-behind file):

// Don't forget to reference the Elmah assembly and import its namespace.

void ErrorLog_Filtering(object sender, ExceptionFilterEventArgs e)
{
    if (e.Exception.GetBaseException() is HttpRequestValidationException)
        e.Dismiss();
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top