ASP.Net HttpModule List<> content

Posted by test on Stack Overflow See other posts from Stack Overflow or by test
Published on 2010-04-09T13:22:29Z Indexed on 2010/04/09 13:43 UTC
Read the original article Hit count: 341

Filed under:
|

We have created an http module that loads data on initialize into a list, and uses that list on every endrequest event of application. However we got a null reference exception on the module at endRequest event complaining that the content is null. Yet we are sure that at module initialization we have put non-null objects correctly.

How is this possible? Any ideas?

Thanks in advance.

The place where i fill the data into the list what named as "Pages" :

                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        LandingPageDetails details = new LandingPageDetails();
                        details.DomainId = Convert.ToInt32(reader["DomainId"]);
                        details.PageId = Convert.ToInt32(reader["TrackingPageId"]);
                        details.PageAddress = Convert.ToString(reader["PageAddress"]);
                        if (!string.IsNullOrEmpty(details.PageAddress))
                        {
                            Pages.Add(details);
                        }
                    }
                }

// Find the related record on EndRequesst event

        LandingPageDetails result = Pages.Find
        (
            delegate(LandingPageDetails current)
            {
                return current.PageAddress.Equals(url, StringComparison.InvariantCultureIgnoreCase);
            }
        );

The line what we get the error

return current.PageAddress.Equals(url, StringComparison.InvariantCultureIgnoreCase);

"current" is the null object

P.S : It works properly, but one day later contents become null. Possibly, there is something wrong on IIS. Our server is Windows 2003, IIS 6.0

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about httpmodule