Today I learnt some exciting (weird, may I call it) thing about using QueryStrings in ASPX pages.
When you pass a querystring in an ASP page, and you need to check the same, you go ahead and do:
If Request.QueryString("whatever") = "whatever" Then 'Do Whatever End If
If the page do not get the querystring "whatever", it wouldn't mind.
BUT, in ASP.NET, the page would throw an expception (Object reference not set to an instance of an object)!!!
So, if you have a scenario in your application where you might not pass the querystring, you might want to do something on this line:
If Not (Request.QueryString("whatever") Is Nothing) AndAlso Request.QueryString("whatever") = "whatever" Then 'Do Whatever End If
(MAY BE THIS WAS TO REMIND ME: .NET IS ALL ABOUT OBJECTS. IF THERE IS NO OBJECT, YOU AIN'T GONNA DO A DAMN!)
Have you ever encountered such cases? What measures did you take to tackle them? Please add your two cents.