Losing Session on Page Load and Postback

I have an app that has been working just fine to date, but recently started dropping session.
I have enclosed the error messages I am getting, but do not know what to make of them.
The errors happen on page_load after leaving my login page or on postback.

Object cannot be cast from DBNull to other types.

and

Operator '<>' is not defined for type 'DBNull' and type 'DBNull'.

Here is the page load event on the default page:

   If Request.QueryString("LostSession") = "True" And Not IsPostBack Then
            Me.Page.ClientScript.RegisterClientScriptBlock(Me.GetType, "SessionWarning", "alert('Your session was lost.');", True)
        End If

Here is the page load event on the second page:

    If IsNothing(Session("id")) Or Not IsNumeric(Session("id")) Then
            Response.Redirect("default.aspx?LostSession=True", True)
        End If
devnewbeeAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MrpipkinCommented:


OK since the web server is all OK try a few of the following steps  before you can narrow this down.

Make sure your server is correctly working I.e no one has changes you network setting, firewall and check your exception tab.

I would check for the following, make sure your switches a functioning OK, check that no one has put a telephone cable back into a the switch .

If you have a WAN step up check that your bridgehead serve is working correctly.

Try to ping and trace route to the a extremal address when this occurs or try GFI network  monitor and keep pinging the server and switch and router to see if you are getting drop outs.

Make sure your DNS setting and DHCP are all set up correctly and that your site trust are correctly working.

Regards
0
Alfred A.Commented:
----> I have an app that has been working just fine to date, but recently started dropping session.

First of all, did you have a sudden increase with the number of users concurrently hitting your web site?

Did you enhanced your web application by adding heavier processing such as heavier SQL queries, heavier coding logic, and heavy session use?

What session management are you currently using InProc, State Server, or SQL Server?

If your answer in my first two questions is "yes" and your session management is InProc, then there is a possibility that this is the reason for the session droppings.  I encountered this type of problem before where we always get different types of error that we cannot even understand why it is happening.  When I changed my heavy web application before to "State Server" most of the object problems I was encountering disappeared!

I hope this helps.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
devnewbeeAuthor Commented:
This fixed my issue.  Thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.