Hi,
I am writing a pre-handler page for aspx pages, in which I
want to call a custom method on the code-behind class file
for the aspx page.
In order to do this I need to somehow get the class full
namespace for the codebehind aspx page from the request
absolute url that I have in the pre-handler page.
The question is how do I obtain the class namespace string
so I can use reflection on the webserver dll file to load
this dynamically. At present I am using a lookup table
that maps the absolute url to the namespace class, and
then using the assembly.gettype() and then creating an
instance of the class from using the type.
I am sure there must be some method available that doesn't
require maintainence of this list?? - as the default pre-
handler passes the absolute url request to the aspx page
by default anyway. Any ideas?
Thanks.
Pete. 6 1462
"Pete" <Pe*********@hotmail.com> wrote in message
news:2b*****************************@phx.gbl... Hi,
I am writing a pre-handler page for aspx pages, in which I want to call a custom method on the code-behind class file for the aspx page.
In order to do this I need to somehow get the class full namespace for the codebehind aspx page from the request absolute url that I have in the pre-handler page.
Can you read the .aspx file? If so, you can read the @Page directive, which
should include a Inherits attribute which should tell you the full name of
the class. I believe that should be enough to load the class and create an
instance of it so that you can call a method.
--
John Saunders
Internet Engineer jo***********@surfcontrol.com
John,
When you say read, are you meaning reading the file at
runtime, and parsing this information out from the file?
Does the default .Net pre-page handler use this technique
to get the code behind class to instantiate for the page?,
surely not?? Or if so, is there some function that I can
call to get the code-behind class for the aspx page?
Thanks.
Pete. -----Original Message----- "Pete" <Pe*********@hotmail.com> wrote in message news:2b*****************************@phx.gbl... Hi,
I am writing a pre-handler page for aspx pages, in
which I want to call a custom method on the code-behind class
file for the aspx page.
In order to do this I need to somehow get the class full namespace for the codebehind aspx page from the request absolute url that I have in the pre-handler page. Can you read the .aspx file? If so, you can read the
@Page directive, whichshould include a Inherits attribute which should tell you
the full name ofthe class. I believe that should be enough to load the
class and create aninstance of it so that you can call a method. -- John Saunders Internet Engineer jo***********@surfcontrol.com
.
"Pete" <Pe*********@hotmail.com> wrote in message
news:0a****************************@phx.gbl... John,
When you say read, are you meaning reading the file at runtime, and parsing this information out from the file?
Yes, I meant reading the file and parsing the information. There's not that
much of it, after all.
Does the default .Net pre-page handler use this technique to get the code behind class to instantiate for the page?, surely not?? Or if so, is there some function that I can call to get the code-behind class for the aspx page?
Why? What would be wrong with that technique? Especially if you cache the
result?
I don't know if this is what ASP.NET uses.
--
John Saunders
Internet Engineer jo***********@surfcontrol.com -----Original Message----- "Pete" <Pe*********@hotmail.com> wrote in message news:2b*****************************@phx.gbl... Hi,
I am writing a pre-handler page for aspx pages, in which I want to call a custom method on the code-behind class file for the aspx page.
In order to do this I need to somehow get the class full namespace for the codebehind aspx page from the request absolute url that I have in the pre-handler page.
Can you read the .aspx file? If so, you can read the @Page directive, whichshould include a Inherits attribute which should tell you the full name ofthe class. I believe that should be enough to load the class and create aninstance of it so that you can call a method. -- John Saunders Internet Engineer jo***********@surfcontrol.com
.
"Pete" <Pe*********@hotmail.com> wrote in message
news:0a****************************@phx.gbl... John,
When you say read, are you meaning reading the file at runtime, and parsing this information out from the file?
Yes, I meant reading the file and parsing the information. There's not that
much of it, after all.
Does the default .Net pre-page handler use this technique to get the code behind class to instantiate for the page?, surely not?? Or if so, is there some function that I can call to get the code-behind class for the aspx page?
Why? What would be wrong with that technique? Especially if you cache the
result?
I don't know if this is what ASP.NET uses.
--
John Saunders
Internet Engineer jo***********@surfcontrol.com -----Original Message----- "Pete" <Pe*********@hotmail.com> wrote in message news:2b*****************************@phx.gbl... Hi,
I am writing a pre-handler page for aspx pages, in which I want to call a custom method on the code-behind class file for the aspx page.
In order to do this I need to somehow get the class full namespace for the codebehind aspx page from the request absolute url that I have in the pre-handler page.
Can you read the .aspx file? If so, you can read the @Page directive, whichshould include a Inherits attribute which should tell you the full name ofthe class. I believe that should be enough to load the class and create aninstance of it so that you can call a method. -- John Saunders Internet Engineer jo***********@surfcontrol.com
.
Caching sounds good but it would be nice if someone from
Microsoft could give an indication as to how ASP.Net does
it internally. Maybe the information is already known in
a property of a object model that is accessible from the
pre-page handler, perhaps??
Pete. -----Original Message----- "Pete" <Pe*********@hotmail.com> wrote in message news:0a****************************@phx.gbl... John,
When you say read, are you meaning reading the file at runtime, and parsing this information out from the file? Yes, I meant reading the file and parsing the
information. There's not thatmuch of it, after all.
Does the default .Net pre-page handler use this
technique to get the code behind class to instantiate for the
page?, surely not?? Or if so, is there some function that I
can call to get the code-behind class for the aspx page? Why? What would be wrong with that technique? Especially
if you cache theresult?
I don't know if this is what ASP.NET uses. -- John Saunders Internet Engineer jo***********@surfcontrol.com
>-----Original Message----- >"Pete" <Pe*********@hotmail.com> wrote in message >news:2b*****************************@phx.gbl... >> Hi, >> >> I am writing a pre-handler page for aspx pages, in
which I >> want to call a custom method on the code-behind class file >> for the aspx page. >> >> In order to do this I need to somehow get the class
full >> namespace for the codebehind aspx page from the
request >> absolute url that I have in the pre-handler page. > >Can you read the .aspx file? If so, you can read the @Page directive, which >should include a Inherits attribute which should tell
you the full name of >the class. I believe that should be enough to load the class and create an >instance of it so that you can call a method. >-- >John Saunders >Internet Engineer >jo***********@surfcontrol.com > > >. >
.
Caching sounds good but it would be nice if someone from
Microsoft could give an indication as to how ASP.Net does
it internally. Maybe the information is already known in
a property of a object model that is accessible from the
pre-page handler, perhaps??
Pete. -----Original Message----- "Pete" <Pe*********@hotmail.com> wrote in message news:0a****************************@phx.gbl... John,
When you say read, are you meaning reading the file at runtime, and parsing this information out from the file? Yes, I meant reading the file and parsing the
information. There's not thatmuch of it, after all.
Does the default .Net pre-page handler use this
technique to get the code behind class to instantiate for the
page?, surely not?? Or if so, is there some function that I
can call to get the code-behind class for the aspx page? Why? What would be wrong with that technique? Especially
if you cache theresult?
I don't know if this is what ASP.NET uses. -- John Saunders Internet Engineer jo***********@surfcontrol.com
>-----Original Message----- >"Pete" <Pe*********@hotmail.com> wrote in message >news:2b*****************************@phx.gbl... >> Hi, >> >> I am writing a pre-handler page for aspx pages, in
which I >> want to call a custom method on the code-behind class file >> for the aspx page. >> >> In order to do this I need to somehow get the class
full >> namespace for the codebehind aspx page from the
request >> absolute url that I have in the pre-handler page. > >Can you read the .aspx file? If so, you can read the @Page directive, which >should include a Inherits attribute which should tell
you the full name of >the class. I believe that should be enough to load the class and create an >instance of it so that you can call a method. >-- >John Saunders >Internet Engineer >jo***********@surfcontrol.com > > >. >
. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Glenn Venzke |
last post by:
I'm trying to write/compile a class that (1) accesses all the intrinsic ASP.NET objects (2) Uses Server.Transfer to redirect a user back to a log in page if a session has expired. I've gotten...
|
by: Not Available |
last post by:
On the host server:
namespace JCart.Common
public class JCartConfiguration : IConfigurationSectionHandler
private static String dbConnectionString;
public static String ConnectionString
{
get...
|
by: Brent |
last post by:
I'm having odd problems with the WebResponse class. Some servers are
speedy, while others don't play along at all. Consider the following pages*:
...
|
by: sfoxover |
last post by:
Hi,
Could someone please give me some suggestions on how to make this class
robust. I need to be able to handle around 20 similtanious requests to
this class which causes a web browser to...
|
by: Ray Stevens |
last post by:
I have a dataclass that was created by a code generator. A snippit of its
output is as follows:
namespace SoftwareAG.EntireX.NETWrapper.Generated.laf801n1.Groups
{
public class Laf801n1
| |
by: John Smith |
last post by:
How can I allow someone to cast my C# class into System.String? Is it
possible in C#? In C++ I used "operator" keyword to mark C++ member
function.
|
by: Peter Cranz |
last post by:
hello,
I've got the following problem:
I have a construct similar like this:
namespace A {
class X {
|
by: bharathreddy |
last post by:
Here I will given an example on how to access the session, application and querystring variables in an .cs class file.
Using System.Web.HttpContext class.
1) For accesing session variables :...
|
by: Nathan Sokalski |
last post by:
I have a page in my site that I need the absolute url of. Is there a
function in .NET to which you can pass a relative url or something such as
"~/mydirectory/mypage.aspx" which will return an...
|
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...
|
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,...
| |
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...
|
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...
|
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...
|
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,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |