Print Page | Close Window

ASP newb question

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=524
Printed Date: 28 March 2026 at 11:59pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: ASP newb question
Posted By: joshb
Subject: ASP newb question
Date Posted: 25 February 2003 at 8:36pm

I need to ask a quick question. how can I trap a null, if I am going to CStr() it if it has a string in it?

Example:

If (false Or CStr(Session("UserAuthorization"))="") Or (InStr(1,authorizedUsers,Session("UserAuthorization"))>=1) Then

Sometimes it comes back null spitting the error 

Invalid use of Null: 'CStr'

So how would I go about trapping, rather checking for a null and then going about my bizzzzness. all help would be greaty apreciated.



-------------
I'm a wannabe programmer that knows how to do nothing but create invalid procedure arguments.
http://www.soopportal.com">



Replies:
Posted By: MorningZ
Date Posted: 25 February 2003 at 11:32pm
CStr( Session("UserAuthorization") & "" ) = ""

will protect against that error... which this method is also known as http://www.4guysfromrolla.com/webtech/031699-1.shtml - "poor man's null"

-------------
Contribute to the working anarchy we fondly call the Internet



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net