A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/serilog-web/classic/issues/62 below:

Exception with null key in form data · Issue #62 · serilog-web/classic · GitHub

I have an old site using ASP.NET web forms and MS ajax. The MS ajax seems to be adding an extra ampersand to the post data:
...&__spDummyText2=&__ASYNCPOST=true&

I believe this is being translated into a null entry in the Form.AllKeys array. When I try to output form data in the log I get a null reference error. I believe it's the "key.IndexOf" on this line (SerilogWebClassicConfiguration.cs):
if (FilterPasswordsInFormData && FilteredKeywordsInFormData.Any(keyword => key.IndexOf(keyword, StringComparison.OrdinalIgnoreCase) != -1))

Here is the top of the stack trace:
[NullReferenceException: Object reference not set to an instance of an object.]
SerilogWeb.Classic.<>c__DisplayClass38_0.<FilterPasswords>b__0(String keyword) +7
System.Linq.Enumerable.Any(IEnumerable1 source, Func2 predicate) +169
SerilogWeb.Classic.SerilogWebClassicConfiguration.FilterPasswords(String key, String value) +121

If I don't apply any filter there is no error, the problem is that being the old web forms I have a large __VIEWSTATE that I don't want in the log.

Can a null check on the key variable be added? Or possibly in the calling code something like:
configuration.FilterPasswords(k ?? "", v)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4