How can I get this url?

A

ashelley

In IE browser, if you type in http://www.microsoft.com/MyTestPage.asp,
definitely it is an invalid url, I noticed that I will come to this url
instead:
http://www.microsoft.com/info/smart404.asp?404;http://www.microsoft.com/MyTe
stPage.asp.

My question is: how can the iis get the wrong url
(http://www.microsoft.com/MyTestPage.asp) and pass it to another url as a
parameter?

Thanks!

Jason

a custom error page. if you look at your web site properties see the
custom errors section. Write your own error page to do what u want.

capture page urls / send out emails / update logs

whatever u want

-Adam
 
J

Jason Zhou

I did my own error page, but how can I capature that wrong url then?

Thanks!

Jason
 
A

ashelley

I did my own error page, but how can I capature that wrong url then?

Thanks!

Jason

Hello,

I gave it a try myself and I found that

HttpContext.Current.Request.RawUrl in the error page returns this:
"/errormessagre/webform1.aspx?404;http://localhost/blah"

I assume that if u take everything right fo the 404; you should get
u're url.

-Adam
 
J

Jason Zhou

Really? I tried this before but seems did not work. I will try it again
then.

Thank you very much for the help!

Jason
 
J

Jason Zhou

Adam,

Sorry, one more question.

From your sample, looks like in your one aspx page, you tried to call
http://localhost/blah, and this error was caught by webform1.aspx, and you
got this error message in your original aspx page. I am wondering in this
webform1.aspx instead of your original aspx page, can you get
http://localhost/blah this information?

Thanks!

Jason
 
A

ashelley

From your sample, looks like in your one aspx page, you tried to call
http://localhost/blah, and this error was caught by webform1.aspx, and you
got this error message in your original aspx page.

I setup the webform1.aspx as the handler for error 404's within IIS.
The original web page does not exist and therefore can't handle
anything. If the error happens inside the scope of a configured
application then you will be able to handle it with its own 404
handler.

The problem is that if a 404 happens it is because the page doesn't
exist. You can do anything you want with this information.

-Adam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top