Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session Variables not established - Object_required error 500 1

Status
Not open for further replies.

sixteamparlay

IS-IT--Management
Aug 1, 2008
46
US
Line 76-78:

If Session("PalletID") = Nothing Then
Session("PalletID") = 0
End If


I tried "If Session("PalletID") IS Nothing" and still get the error "Object_required". I am checking to see if Session Variable PalletID was established, if it wasn't set it to 0

IIS ERROR LOG:
2009-03-18 13:32:08 172.16.1.250 GET /HiLo/PutAwayLocationSelectX.asp |76|800a01a8|Object_required 1 - 172.16.4.178 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+6.0;+SLCC1;+.NET+CLR+2.0.50727;+.NET+CLR+3.0.04506;+.NET+CLR+3.5.21022;+.NET+CLR+1.1.4322) 500 0 0 187

Does anyone have code to check for a non-existant session variable? In .NET 1.1 Session("PalletID") = NULL was good enough, in .NET 2.0 it crashes
 
>If Session("PalletID") = Nothing Then
If Session("PalletID") is an object (make sure it is), to check if it is nothing, it is not "=", it is "is".
[tt] If Session("PalletID") [red]is[/red] Nothing Then[/tt]
 
The other way to do it (without making it an object):

<%
if isNull(session("var")) or isEmpty(session("var")) or trim(session("var")) = "" then session("var") = 0
%>

^ that will check all instances of "blanks"

TIP: trying googling the answer before posting, you'll find that more times than not someone else somewhere has had the same request and posted an answer online.
----
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javascript enabled browsers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top