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.gettyp e() 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 1465
"Pete" <Pe*********@ho tmail.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***********@s urfcontrol.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*********@ho tmail.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*********@ho tmail.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***********@s urfcontrol.com -----Original Message----- "Pete" <Pe*********@ho tmail.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*********@ho tmail.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***********@s urfcontrol.com -----Original Message----- "Pete" <Pe*********@ho tmail.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*********@ho tmail.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*********@ho tmail.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*********@ho tmail.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*********@ho tmail.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 inconsistent results. The redirection works perfectly if the user session has expired, but throws an exception if it hasn't. Both "ASPIntrinsicObjects" and...
|
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
{
return dbConnectionString;
|
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*:
http://planetbrent.com/test.aspx?url=http://www.yahoo.com
http://planetbrent.com/test.aspx?url=http://www.msn.com
http://planetbrent.com/test.aspx?url=http://www.sec.gov...
|
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 display a waiting message
while it requests XML data from a third party server. Some requests can
take around 30 seconds.
Usually the first time I do...
|
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 : System.Web.HttpContext.Current.Session
2) For accesing Application variables : System.Web.HttpContext.Current.Application
3) For accesing QueryString...
|
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 absolute url? I need this
because at the moment I do not know what the domain name (or if there is the
possibility of the site going in a subdirectory)...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
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.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |