472,789 Members | 1,041 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,789 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 5527
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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.