473,413 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

Test If HttpContext.Current.Application("var") exists (vb.net)

gn
I am a VB.Net newbie and have tried to search for this answer without
success - What is the exact syntax to test if
HttpContext.Current.Application("var") exists in vb.net

I have tried:

If (HttpContext.Current.Application("var").ToString) <> "" Then

That gives me System.NullReferenceException: Object reference not set
to an instance of an object Error, I suspect because I am trying to
convert nothing into a string??

If HttpContext.Current.Application("var") is null then

Didn't like that either, syntax checker said I should use system.DBnull
since 'null' is no longer supported??

I am sure I am missing something very simple, could someone please give
me a nudge in the right direction?

Thanks

Nov 19 '05 #1
2 5252
Tim
Hello,
Check if it is nothing like so:

HttpContext.Current.Application.Item("MyVal") Is Nothing

Tim Stall
http://timstall.dotnetdevelopersjournal.com/
"gn@dana.ucc.nau.edu" wrote:
I am a VB.Net newbie and have tried to search for this answer without
success - What is the exact syntax to test if
HttpContext.Current.Application("var") exists in vb.net

I have tried:

If (HttpContext.Current.Application("var").ToString) <> "" Then

That gives me System.NullReferenceException: Object reference not set
to an instance of an object Error, I suspect because I am trying to
convert nothing into a string??

If HttpContext.Current.Application("var") is null then

Didn't like that either, syntax checker said I should use system.DBnull
since 'null' is no longer supported??

I am sure I am missing something very simple, could someone please give
me a nudge in the right direction?

Thanks

Nov 19 '05 #2
Duh!

I think I am in need of a rest, I knew that!
Thank you for saving me from myself

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Phil Ten | last post by:
Hello, I am working on a .NET C++ project based on the "Class Library (.NET)" wizard of Visual Studio .NET 2003. I would like to know if my .NET component is running in a ASP.NET page (.apsx...
2
by: Francois Malgreve | last post by:
hello guys, I have some helper class in my ASP.NET pplication who basically contains static methods. I used them as helper methods to do small jobs that I can use at many places in my code. ...
2
by: moondaddy | last post by:
I need to set a variable to a session variable (if that's what you call it) like this: dim ds as dataset = HttpContext.Current.Session("CustDataSet") But I get an exception if this variable...
2
by: | last post by:
Today I learned that creating cookies inside of a custom class in ASP.NET 2.0 requires that you prefix it with HttpContext.Current..., e.g. : ...
0
by: Aaron Morton | last post by:
I'm working on a IHttpModule that handles the PreSendRequestHeaders event from the HttpApplication, if the event is raised after EndRequest then HttpContext.Current is null. If it is raised before...
8
by: eric | last post by:
I have a 2.0 asp.net project. In a class contained within a seperate project, I am trying to reference HttpContext.Current.Session but Session is always null. I've tried implementing...
6
by: =?Utf-8?B?emlubw==?= | last post by:
in asp.net 2, I load a dataset from the Cache object into a local object to use to perform processing. I had been using httpcontext.current.cache and what I noticed is sometime I'm not able to get...
3
by: Madhur | last post by:
Hello I am delivering an asp.net 2.0 application to my customer. I need to know, If I need to check for the condition of HttpContext.Current to be null in my business logic. I have extensively...
8
by: SpaceMarine | last post by:
hello, my web app form has many DropDownLists that pull their content from a database. these calls are in a Business Access Layer, when first checks the context's Cache object for existing...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.