473,404 Members | 2,187 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,404 software developers and data experts.

Getting 'Page' in a class method

I am using a third party product that requires a reference to a page, Me.Page
for example. I would like to use this product in a function, in a vb class,
that I am writing. I know that I can pass the page, as an object, into the
method, but I was wondering if there was a way to get the current page,
inside a vb class, using a .NET method.

Thanks,
Leonard
Nov 22 '05 #1
2 1950
"Leonard Rutkowski" <Le**************@discussions.microsoft.com> wrote in
message news:33**********************************@microsof t.com...
I am using a third party product that requires a reference to a page,
Me.Page
for example. I would like to use this product in a function, in a vb
class,
that I am writing. I know that I can pass the page, as an object, into
the
method, but I was wondering if there was a way to get the current page,
inside a vb class, using a .NET method.


HttpContext.Current is the current instance of HttpContext (or null, if
you're not inside of a request). HttpContext.Handler is the IHttpHandler
instance which is processing the request. If that handler is a Page, then
you can cast to Page:

DirectCast(HttpContext.Current.Handler, Page)

John Saunders
Nov 22 '05 #2
Hi John,
Just what I was looking for. I had looked through the help, but didn't
quit understand what was needed.

Thanks,
Leonard

"John Saunders" wrote:
"Leonard Rutkowski" <Le**************@discussions.microsoft.com> wrote in
message news:33**********************************@microsof t.com...
I am using a third party product that requires a reference to a page,
Me.Page
for example. I would like to use this product in a function, in a vb
class,
that I am writing. I know that I can pass the page, as an object, into
the
method, but I was wondering if there was a way to get the current page,
inside a vb class, using a .NET method.


HttpContext.Current is the current instance of HttpContext (or null, if
you're not inside of a request). HttpContext.Handler is the IHttpHandler
instance which is processing the request. If that handler is a Page, then
you can cast to Page:

DirectCast(HttpContext.Current.Handler, Page)

John Saunders

Nov 22 '05 #3

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

Similar topics

2
by: Leonard Rutkowski | last post by:
I am using a third party product that requires a reference to a page, Me.Page for example. I would like to use this product in a function, in a vb class, that I am writing. I know that I can pass...
4
by: Larry Tate | last post by:
I am wanting to get those cool html error pages that ms produces when I hit an error in asp.net. For instance, when I get a compilation error I get an html error page that shows me the ...
2
by: Alex | last post by:
Hi all, I'm writing a small web application which searches a database based on a date field, and populates a datagrid control with the results. The datagrid control has selection buttons added...
2
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
3
by: Hitesh | last post by:
Hi, I am getting the response from another Website by using the HttpHandler in my current site. I am getting the page but all the images on that page are not appearing only placeholder are...
5
by: Nathan Sokalski | last post by:
I have a user control that contains three variables which are accessed through public properties. They are declared immediately below the "Web Form Designer Generated Code" section. Every time an...
8
by: bryan | last post by:
Is there any way I can get the application path (the one returned by Request.ApplicationPath) in the Application_Start method in Global.asax? Request is not valid there. On a related note, is there...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
0
by: cnys | last post by:
We have an ASP.NET 2.0 (C#) app and we're trying to add tracing into it. The tracing functionality within .NET is great, but when we output this to a file, it's kind of sparse. So, we're looking...
1
by: simbarashe | last post by:
Hie could someone please help me with getting and using the current page url. I have a function that gets the url, I want to use it with header(location : XXX) but it wont work. The code is as...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.