469,267 Members | 1,091 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,267 developers. It's quick & easy.

Invalid URI: The hostname could not be parsed

Do you have any idea why I am getting the following error?

Invalid URI: The hostname could not be parsed.
Inner stack trace
at System.Uri.Parse()
at System.Uri..ctor(String uriString, Boolean dontEscape)
at System.Uri..ctor(String uriString)
at System.Web.HttpRequest.get_UrlReferrer()
at DotNetNuke.CDefault.ManageRequest()
at DotNetNuke.CDefault.Page_Init(Object sender, EventArgs e)
at System.Web.UI.Control.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain()
Currently we experience this around 100 times a day.

Thanks for the information in advance

--

SevDer
http://www.sevder.com
A new .NET Source For .NET Developers

Nov 19 '05 #1
7 23091
Do you have the time of the error?

Have you checked your weblogs to see if you can see any invalid requests
coming through at the same time?

That may be the place to begin...

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"SevDer" <se****@newsgroup.nospam> wrote in message
news:ez*************@TK2MSFTNGP12.phx.gbl...
Do you have any idea why I am getting the following error?

Invalid URI: The hostname could not be parsed.
Inner stack trace
at System.Uri.Parse()
at System.Uri..ctor(String uriString, Boolean dontEscape)
at System.Uri..ctor(String uriString)
at System.Web.HttpRequest.get_UrlReferrer()
at DotNetNuke.CDefault.ManageRequest()
at DotNetNuke.CDefault.Page_Init(Object sender, EventArgs e)
at System.Web.UI.Control.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain()
Currently we experience this around 100 times a day.

Thanks for the information in advance

--

SevDer
http://www.sevder.com
A new .NET Source For .NET Developers

Nov 19 '05 #2
the browser/proxy/firewall is free to put anything it wants in the
UrlReferrer header, so Request.UrlReferrer will not necessarily return a
valid url, thus the thrown execption.

-- bruce (sqlwork.com)
"SevDer" <se****@newsgroup.nospam> wrote in message
news:ez*************@TK2MSFTNGP12.phx.gbl...
Do you have any idea why I am getting the following error?

Invalid URI: The hostname could not be parsed.
Inner stack trace
at System.Uri.Parse()
at System.Uri..ctor(String uriString, Boolean dontEscape)
at System.Uri..ctor(String uriString)
at System.Web.HttpRequest.get_UrlReferrer()
at DotNetNuke.CDefault.ManageRequest()
at DotNetNuke.CDefault.Page_Init(Object sender, EventArgs e)
at System.Web.UI.Control.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain()
Currently we experience this around 100 times a day.

Thanks for the information in advance

--

SevDer
http://www.sevder.com
A new .NET Source For .NET Developers

Nov 19 '05 #3
That is fine but I have the problem when I am checking Request.UrlReferrer
against null.
Instead of being null, it throws an exception.

--

SevDer
http://www.sevder.com
A new .NET Source For .NET Developers
"Bruce Barker" <br******************@safeco.com> wrote in message
news:O%****************@tk2msftngp13.phx.gbl...
the browser/proxy/firewall is free to put anything it wants in the
UrlReferrer header, so Request.UrlReferrer will not necessarily return a
valid url, thus the thrown execption.

-- bruce (sqlwork.com)
"SevDer" <se****@newsgroup.nospam> wrote in message
news:ez*************@TK2MSFTNGP12.phx.gbl...
Do you have any idea why I am getting the following error?

Invalid URI: The hostname could not be parsed.
Inner stack trace
at System.Uri.Parse()
at System.Uri..ctor(String uriString, Boolean dontEscape)
at System.Uri..ctor(String uriString)
at System.Web.HttpRequest.get_UrlReferrer()
at DotNetNuke.CDefault.ManageRequest()
at DotNetNuke.CDefault.Page_Init(Object sender, EventArgs e)
at System.Web.UI.Control.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain()
Currently we experience this around 100 times a day.

Thanks for the information in advance

--

SevDer
http://www.sevder.com
A new .NET Source For .NET Developers


Nov 19 '05 #4
Actually I didn't try this one. I will have a look to that too.
However the interesting thing is it fails at Microsoft's code part not mine.

My code is as follows:
' URL Referrer

Dim URLReferrer As String = ""

If Not Request.UrlReferrer Is Nothing Then

URLReferrer = Request.UrlReferrer.ToString()

End If

Thanks
--

SevDer
http://www.sevder.com
A new .NET Source For .NET Developers
"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:%2****************@TK2MSFTNGP14.phx.gbl...
Do you have the time of the error?

Have you checked your weblogs to see if you can see any invalid requests
coming through at the same time?

That may be the place to begin...

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"SevDer" <se****@newsgroup.nospam> wrote in message
news:ez*************@TK2MSFTNGP12.phx.gbl...
Do you have any idea why I am getting the following error?

Invalid URI: The hostname could not be parsed.
Inner stack trace
at System.Uri.Parse()
at System.Uri..ctor(String uriString, Boolean dontEscape)
at System.Uri..ctor(String uriString)
at System.Web.HttpRequest.get_UrlReferrer()
at DotNetNuke.CDefault.ManageRequest()
at DotNetNuke.CDefault.Page_Init(Object sender, EventArgs e)
at System.Web.UI.Control.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain()
Currently we experience this around 100 times a day.

Thanks for the information in advance

--

SevDer
http://www.sevder.com
A new .NET Source For .NET Developers


Nov 19 '05 #5
1.
A value of type System.Uri cannot be converted to String.

2.
Have you tried using
URLReferrer = Request.ServerVariables("http_referer")

?
Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"SevDer" <se****@newsgroup.nospam> wrote in message
news:u7**************@TK2MSFTNGP09.phx.gbl...
That is fine but I have the problem when I am checking Request.UrlReferrer against null.
Instead of being null, it throws an exception.

--

SevDer
http://www.sevder.com
A new .NET Source For .NET Developers
"Bruce Barker" <br******************@safeco.com> wrote in message
news:O%****************@tk2msftngp13.phx.gbl...
the browser/proxy/firewall is free to put anything it wants in the UrlReferrer header,
so Request.UrlReferrer will not necessarily return a valid url, thus the thrown
execption.

-- bruce (sqlwork.com)
"SevDer" <se****@newsgroup.nospam> wrote in message
news:ez*************@TK2MSFTNGP12.phx.gbl...
Do you have any idea why I am getting the following error?

Invalid URI: The hostname could not be parsed.
Inner stack trace
at System.Uri.Parse()
at System.Uri..ctor(String uriString, Boolean dontEscape)
at System.Uri..ctor(String uriString)
at System.Web.HttpRequest.get_UrlReferrer()
at DotNetNuke.CDefault.ManageRequest()
at DotNetNuke.CDefault.Page_Init(Object sender, EventArgs e)
at System.Web.UI.Control.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain()
Currently we experience this around 100 times a day.

Thanks for the information in advance

--

SevDer
http://www.sevder.com
A new .NET Source For .NET Developers




Nov 19 '05 #6
I caught the referrer.

These guys are coming as
http://www%2echina%2dairline%2ecom/s...FpcmxpbmUuY29t

But their browsers are fine. They are all MSIE 6.0 browsers.
I didn't get why this is happening!

Do you have any idea? Can it be like a software that uses some sites to get
links or so?
So that it does not send the url properly?

--

SevDer
http://www.sevder.com
A new .NET Source For .NET Developers
"SevDer" <se****@newsgroup.nospam> wrote in message
news:u4**************@tk2msftngp13.phx.gbl...
Actually I didn't try this one. I will have a look to that too.
However the interesting thing is it fails at Microsoft's code part not
mine.

My code is as follows:
' URL Referrer

Dim URLReferrer As String = ""

If Not Request.UrlReferrer Is Nothing Then

URLReferrer = Request.UrlReferrer.ToString()

End If

Thanks
--

SevDer
http://www.sevder.com
A new .NET Source For .NET Developers
"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:%2****************@TK2MSFTNGP14.phx.gbl...
Do you have the time of the error?

Have you checked your weblogs to see if you can see any invalid requests
coming through at the same time?

That may be the place to begin...

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"SevDer" <se****@newsgroup.nospam> wrote in message
news:ez*************@TK2MSFTNGP12.phx.gbl...
Do you have any idea why I am getting the following error?

Invalid URI: The hostname could not be parsed.
Inner stack trace
at System.Uri.Parse()
at System.Uri..ctor(String uriString, Boolean dontEscape)
at System.Uri..ctor(String uriString)
at System.Web.HttpRequest.get_UrlReferrer()
at DotNetNuke.CDefault.ManageRequest()
at DotNetNuke.CDefault.Page_Init(Object sender, EventArgs e)
at System.Web.UI.Control.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain()
Currently we experience this around 100 times a day.

Thanks for the information in advance

--

SevDer
http://www.sevder.com
A new .NET Source For .NET Developers



Nov 19 '05 #7
Hi SevDer,

So the problem is just caused by the following uri you mentioned:
===========
http://www%2echina%2dairline%2ecom/s...rlines&Site=d3
d3LmNoaW5hLWFpcmxpbmUuY29t
==========

You can get the problem also through the below code:

string str =
"http://www%2echina%2dairline%2ecom/search.asp?Keyword=China+Airlines&Site=d
3d3LmNoaW5hLWFpcmxpbmUuY29t";

Uri uri = new Uri(str);

And as the exception message mentioned, the proboem is the Host name, it
seems that the
"www%2echina%2dairline%2ecom" is incorrectly encoded while the correct one
should be

www.china-airline.com (is not urlencoded).

Also, from the

http://www%2echina%2dairline%2ecom/s...rlines&Site=d3
d3LmNoaW5hLWFpcmxpbmUuY29t

we can find that the request is sent by the search page on the
china-airline site, so the urlreferer is possibly set by code
programmatically.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security

--------------------
| Reply-To: "SevDer" <se******@sevder.com>
| From: "SevDer" <se****@newsgroup.nospam>
| References: <ez*************@TK2MSFTNGP12.phx.gbl>
<#U**************@TK2MSFTNGP14.phx.gbl>
<u4**************@tk2msftngp13.phx.gbl>
| Subject: Re: Invalid URI: The hostname could not be parsed
| Date: Thu, 6 Oct 2005 17:21:39 -0400
| Lines: 102
| Organization: http://www.sevder.com
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.3790.1830
| X-RFC2646: Format=Flowed; Response
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
| Message-ID: <eG**************@TK2MSFTNGP14.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: mail.dtfares.com 68.167.20.2
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP14.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:129604
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| I caught the referrer.
|
| These guys are coming as
|
http://www%2echina%2dairline%2ecom/s...rlines&Site=d3
d3LmNoaW5hLWFpcmxpbmUuY29t
|
| But their browsers are fine. They are all MSIE 6.0 browsers.
| I didn't get why this is happening!
|
| Do you have any idea? Can it be like a software that uses some sites to
get
| links or so?
| So that it does not send the url properly?
|
| --
|
| SevDer
| http://www.sevder.com
| A new .NET Source For .NET Developers
|
|
| "SevDer" <se****@newsgroup.nospam> wrote in message
| news:u4**************@tk2msftngp13.phx.gbl...
| > Actually I didn't try this one. I will have a look to that too.
| > However the interesting thing is it fails at Microsoft's code part not
| > mine.
| >
| > My code is as follows:
| > ' URL Referrer
| >
| > Dim URLReferrer As String = ""
| >
| > If Not Request.UrlReferrer Is Nothing Then
| >
| > URLReferrer = Request.UrlReferrer.ToString()
| >
| > End If
| >
| >
| >
| > Thanks
| >
| >
| > --
| >
| > SevDer
| > http://www.sevder.com
| > A new .NET Source For .NET Developers
| >
| >
| > "S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
| > message news:%2****************@TK2MSFTNGP14.phx.gbl...
| >> Do you have the time of the error?
| >>
| >> Have you checked your weblogs to see if you can see any invalid
requests
| >> coming through at the same time?
| >>
| >> That may be the place to begin...
| >>
| >> --
| >> Sincerely,
| >>
| >> S. Justin Gengo, MCP
| >> Web Developer / Programmer
| >>
| >> www.aboutfortunate.com
| >>
| >> "Out of chaos comes order."
| >> Nietzsche
| >> "SevDer" <se****@newsgroup.nospam> wrote in message
| >> news:ez*************@TK2MSFTNGP12.phx.gbl...
| >>> Do you have any idea why I am getting the following error?
| >>>
| >>> Invalid URI: The hostname could not be parsed.
| >>> Inner stack trace
| >>> at System.Uri.Parse()
| >>> at System.Uri..ctor(String uriString, Boolean dontEscape)
| >>> at System.Uri..ctor(String uriString)
| >>> at System.Web.HttpRequest.get_UrlReferrer()
| >>> at DotNetNuke.CDefault.ManageRequest()
| >>> at DotNetNuke.CDefault.Page_Init(Object sender, EventArgs e)
| >>> at System.Web.UI.Control.OnInit(EventArgs e)
| >>> at System.Web.UI.Control.InitRecursive(Control namingContainer)
| >>> at System.Web.UI.Page.ProcessRequestMain()
| >>>
| >>>
| >>> Currently we experience this around 100 times a day.
| >>>
| >>> Thanks for the information in advance
| >>>
| >>> --
| >>>
| >>> SevDer
| >>> http://www.sevder.com
| >>> A new .NET Source For .NET Developers
| >>>
| >>>
| >>>
| >>
| >>
| >
| >
|
|
|

Nov 19 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Sunny | last post: by
4 posts views Thread by Chris McIlvoy | last post: by
3 posts views Thread by Hans | last post: by
19 posts views Thread by Alan J. Flavell | last post: by
4 posts views Thread by John Smith | last post: by
reply views Thread by dmgonzo | last post: by
reply views Thread by =?Utf-8?B?bmZvdW50YXM=?= | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.