質問

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