473,503 Members | 2,075 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Obtaining class namespace from absolute url request string

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.
Nov 17 '05 #1
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
Nov 17 '05 #2
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
.

Nov 17 '05 #3
"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, 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
.

Nov 17 '05 #4
"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, 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
.

Nov 17 '05 #5
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
>
>
>.
>

.

Nov 17 '05 #6
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
>
>
>.
>

.

Nov 17 '05 #7

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

Similar topics

1
1583
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...
10
3451
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...
6
1628
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*: ...
1
2587
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...
3
3088
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
4
3864
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.
12
1958
by: Peter Cranz | last post by:
hello, I've got the following problem: I have a construct similar like this: namespace A { class X {
0
4995
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 :...
13
2460
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...
0
7067
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
7264
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
7316
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...
1
6975
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...
0
7449
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
5562
agi2029
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,...
0
4666
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...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.