Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 27th, 2005, 02:44 AM
Registered User
 
Join Date: Jun 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using Global.asax varialbles in a class.vb file

I want to use the Application("variable") from global.asax in a class.vb file. It is showing with an error message 'Object reference not set to an instance of an object.' when I try assigning the global.asax applicaion variable to a variable of the class.
This thing works nice with other aspx file.

Please suggest what to do.
 
Old June 27th, 2005, 02:10 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Assuming that your file "class.vb" is not a class that derives from System.Web.UI.Page then the problem is that the class in this VB file has no context for "Application". Only code in the scope of a page can see active instances of the Server/Request/Response/Application classes. You can however access them by way of the "Current" static/shared member of the HttpContext class.

-Peter
 
Old June 30th, 2005, 05:32 AM
Registered User
 
Join Date: Jun 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have inherited the page base class in that class.
Still its not working.

 
Old June 30th, 2005, 07:33 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

http://msdn.microsoft.com/library/en...mberstopic.asp

-Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to declare the global variable in global.asax? calyn_gately ASP.NET 3.5 Basics 0 August 6th, 2008 08:06 PM
using Class in Global.asax oveisi Classic ASP Components 1 July 21st, 2008 03:42 PM
VB version Global.asax missing some code Scott663 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 March 29th, 2007 02:23 PM
In my Global asax file aDo I need the code below n kenn_rosie VS.NET 2002/2003 0 April 11th, 2006 12:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.