Last post Oct 27, 2009 08:11 PM by Danish Ali
Oct 23, 2009 05:11 PM|Raterus|LINK
I know this isn't directly related to HttpModules, but it does have to do with extending the System.Web.HttpApplication Class.
My Global.asax file inherits a custom base class of mine, which in turn inherits System.Web.HttpApplication. I'm putting properties inside this base class.
My problem is, I don't know how to access this Application class from a web form. The "Application" property of the System.Web.UI.Page class is an instance of HttpApplicationState, whereas I need to get at the HttpApplication instance.
Is there any way from within a webform to access the instance of the HttpApplication class I've created, so I can access it's properties. I've put my code below to demonstrate what I want.
<%@ Application Language="VB" inherits="MyApplicationBase" %>
Public Class MyApplicationBase : Inherits System.Web.HttpApplication
Public ReadOnly Property AppCode() As String
Partial Class MyTestWebForm : Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim appCode as String =
??? How can I access the AppCode property in my Base Application Class ???
I'd greatly appreciate any help!
Oct 23, 2009 06:20 PM|Danish Ali|LINK
Use the following code. it will work.
Partial Class _Default
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Oct 27, 2009 02:52 PM|Raterus|LINK
This worked great, thank you for your help!
Oct 27, 2009 08:11 PM|Danish Ali|LINK
Please mark it as answer, so that it can help others too and I can get some points :)