Casting to specific asp.net page type

Posted by DEH on Stack Overflow See other posts from Stack Overflow or by DEH
Published on 2010-03-13T10:36:34Z Indexed on 2010/03/13 10:55 UTC
Read the original article Hit count: 189

Filed under:
|
|

I have an asp.net page with a code-behind class definition as follows:

public partial class examplepage : System.Web.UI.Page

I'd like to set a public property within the page that I can reference from other classes. My understanding is that if I cast to examplepage then I should be able to get at the public property that is specific to example page, as in:

string test=((examplepage)HttpContext.Current.Handler).propertyX;

However, when I try casting as above the compiler does not recognise examplepage. Can anyone tell me how I can cast? I have no specific namespaces defined.

Thanks

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about cast