473,386 Members | 1,644 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,386 software developers and data experts.

HttpHandler question :: Retrieve the Request Page URL?

Hi There!

I'm writing a custom HttpHandler to create watermarks on my PNG images of my
website. So typically, a PNG image is linked in an ASPX page as follows...

<img src="images/test.png" alt="testing" />

So I created an HttpHanlder to handle PNG images, have mapped the PNG
extension in the IIS and also added the HttpModule section in the web.config
file.

In my HttpHandler's ProcessRequest event, I tried to retireve the Page URL
by...

context.Request.Url.AbsoluteUri

But it is not returning the Page's URL but returning the URL of the PNG
image.

How can I retrieve the URL of the PAGE that links the PNG image?

Thank you all in advance!!!
Dave
Nov 19 '05 #1
6 5559
Hi David,

Try HttpRequest.Path. This will give the virtual path of the current request..

Check this link..
http://msdn.microsoft.com/library/de...sPathTopic.asp

Do post a msg back in case this dosent help...

Happy Coding

"David Bowey" wrote:
Hi There!

I'm writing a custom HttpHandler to create watermarks on my PNG images of my
website. So typically, a PNG image is linked in an ASPX page as follows...

<img src="images/test.png" alt="testing" />

So I created an HttpHanlder to handle PNG images, have mapped the PNG
extension in the IIS and also added the HttpModule section in the web.config
file.

In my HttpHandler's ProcessRequest event, I tried to retireve the Page URL
by...

context.Request.Url.AbsoluteUri

But it is not returning the Page's URL but returning the URL of the PNG
image.

How can I retrieve the URL of the PAGE that links the PNG image?

Thank you all in advance!!!
Dave

Nov 19 '05 #2
Hi Vishnu,

Thanks for the help! But it didn't work out. I tried with the following
code...

context.Request.Path

It is still giving me the path of the PNG image and not the ASPX file path.

Any ideas?

Thanks again!
Dave

"Vishnu-Chivukula" <Vi*************@discussions.microsoft.com> wrote in
message news:32**********************************@microsof t.com...
Hi David,

Try HttpRequest.Path. This will give the virtual path of the current
request..

Check this link...
http://msdn.microsoft.com/library/de...sPathTopic.asp

Do post a msg back in case this dosent help...

Happy Coding

"David Bowey" wrote:
Hi There!

I'm writing a custom HttpHandler to create watermarks on my PNG images of
my
website. So typically, a PNG image is linked in an ASPX page as
follows...

<img src="images/test.png" alt="testing" />

So I created an HttpHanlder to handle PNG images, have mapped the PNG
extension in the IIS and also added the HttpModule section in the
web.config
file.

In my HttpHandler's ProcessRequest event, I tried to retireve the Page
URL
by...

context.Request.Url.AbsoluteUri

But it is not returning the Page's URL but returning the URL of the PNG
image.

How can I retrieve the URL of the PAGE that links the PNG image?

Thank you all in advance!!!
Dave

Nov 19 '05 #3

"David Bowey" <db@f.coz> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Hi There!

I'm writing a custom HttpHandler to create watermarks on my PNG images of
my website. So typically, a PNG image is linked in an ASPX page as
follows...

<img src="images/test.png" alt="testing" />

So I created an HttpHanlder to handle PNG images, have mapped the PNG
extension in the IIS and also added the HttpModule section in the
web.config file.

In my HttpHandler's ProcessRequest event, I tried to retireve the Page URL
by...

context.Request.Url.AbsoluteUri

But it is not returning the Page's URL but returning the URL of the PNG
image.

How can I retrieve the URL of the PAGE that links the PNG image?

Thank you all in advance!!!
Dave

Nov 19 '05 #4
>added the HttpModule section in the web.config
typo??? You should be mapping the HttpHandler section in the web.config
since you wrote a handler and not a module.

--
Regards,
Alvin Bruney

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
------------------------------------------------------------

"Vishnu-Chivukula" <Vi*************@discussions.microsoft.com> wrote in
message news:32**********************************@microsof t.com...
Hi David,

Try HttpRequest.Path. This will give the virtual path of the current
request..

Check this link...
http://msdn.microsoft.com/library/de...sPathTopic.asp

Do post a msg back in case this dosent help...

Happy Coding

"David Bowey" wrote:
Hi There!

I'm writing a custom HttpHandler to create watermarks on my PNG images of
my
website. So typically, a PNG image is linked in an ASPX page as
follows...

<img src="images/test.png" alt="testing" />

So I created an HttpHanlder to handle PNG images, have mapped the PNG
extension in the IIS and also added the HttpModule section in the
web.config
file.

In my HttpHandler's ProcessRequest event, I tried to retireve the Page
URL
by...

context.Request.Url.AbsoluteUri

But it is not returning the Page's URL but returning the URL of the PNG
image.

How can I retrieve the URL of the PAGE that links the PNG image?

Thank you all in advance!!!
Dave

Nov 19 '05 #5
Hello David,

You can not make this happen using the builtin objects, because as far as
the web server is concerned this is two completely separate requests, completely
independent of each other.

However, you could try passing the page name along as a parameter on the
query string. If you do that, make sure you test it for null though, because
if an image is direct-linked without the page name, you'll throw an exception
if you try and do anything with it.

--
Matt Berther
http://www.mattberther.com
Hi There!

I'm writing a custom HttpHandler to create watermarks on my PNG images
of my website. So typically, a PNG image is linked in an ASPX page as
follows...

<img src="images/test.png" alt="testing" />

So I created an HttpHanlder to handle PNG images, have mapped the PNG
extension in the IIS and also added the HttpModule section in the
web.config file.

In my HttpHandler's ProcessRequest event, I tried to retireve the Page
URL by...

context.Request.Url.AbsoluteUri

But it is not returning the Page's URL but returning the URL of the
PNG image.

How can I retrieve the URL of the PAGE that links the PNG image?

Thank you all in advance!!!
Dave


Nov 19 '05 #6
Hi Dave,

I haven't tried, but the referrer should be what you're looking for :
Context.Request.UrlReferrer.PathAndQuery, for instance.

HTH,

Michel
"David Bowey" <db@f.coz> wrote in message news:<#3**************@TK2MSFTNGP14.phx.gbl>...
Hi There!

I'm writing a custom HttpHandler to create watermarks on my PNG images of my
website. So typically, a PNG image is linked in an ASPX page as follows...

<img src="images/test.png" alt="testing" />

So I created an HttpHanlder to handle PNG images, have mapped the PNG
extension in the IIS and also added the HttpModule section in the web.config
file.

In my HttpHandler's ProcessRequest event, I tried to retireve the Page URL
by...

context.Request.Url.AbsoluteUri

But it is not returning the Page's URL but returning the URL of the PNG
image.

How can I retrieve the URL of the PAGE that links the PNG image?

Thank you all in advance!!!
Dave

Nov 19 '05 #7

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

Similar topics

5
by: Earl Teigrob | last post by:
My company sells software and wants to provide downloadable product. Some of these downloads will be full CD's of over 550M I had everything working fine using Response.filewrite() but when we...
3
by: Jed | last post by:
I have written an HttpHandler which I invoke through an ashx page. The HttpHandler does various things to process the request, then it is supposed to redirect to a confirmation page. Everything...
2
by: rpale | last post by:
We want to create server-side code that will retrieve the user requested pages, then manipulate the content of those pages just before being sent back to the user. We tried the following: ...
0
by: Anonieko | last post by:
Jefrey Palermo How to do Url Rewriting with just an HttpHandler (without the side-effects) - level 400 posted on Wednesday, August 10, 2005 7:21 PM If you are interested in doing Url Rewriting...
8
by: bryan | last post by:
I've got a custom HttpHandler to process all requests for a given extension. It gets invoked OK, but if I try to do a Server.Transfer I get an HttpException. A Response.Redirect works, but I really...
6
by: Mike | last post by:
Hi, I have a problem of page redirection. Basically, the user has to connect to the local web server, but some pages need to be served by a remote server, because it contains some confidential...
5
by: zlf | last post by:
Hello, I try to use a custom HttpHandler to add something to session, then display the original page. public void ProcessRequest(HttpContext context) { context.Session = "test"; } But, a...
2
by: wickedHangover | last post by:
I'm writing some code to act as a proof of concept which at this point works ok, there is a minor issue I would like to resolve. What I have is an image database being served in an academic...
5
by: Author | last post by:
I followed the example at http://support.microsoft.com/kb/308001/EN-US/ and created my own HttpHandler. Here is the code: using System.Web; namespace MyNameSpace { public class...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...

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.