Sign In  |  Register
 
 DotNetNuke Powered!
DotNetNuke Support Forums

Invalid URI: The hostname could not be parsed

Rate this topic:

Please Register to post a reply.
Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.

AuthorMessages
sonalij
Posts:24



07/30/2007 9:07 AM  

I'm very new to DotNetNuke, and having some major issues with the pages I'm working on.

I downloaded a database called DNN, and I think everything is set up properly, but I'm still having problems.

There's a table called "PortalAlias" in the database (which I'm opening using an SQL server), and in it there are three columns: PortalAliasID, PortalID and HTTPAlias. The first line has Alias 1, ID 0, and whatever I type into the HTTPAlias is the site that explorer directs to when I type in http://localhost/dnn (for example if I type in www.google.com in the table, and then in internet explorer type in http://localhost/dnn then it directs to google) . If I make HTTPAlias read "localhost\dnn" then I get the following error:

Server Error in '/Dnn' Application.


Invalid URI: The hostname could not be parsed.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UriFormatException: Invalid URI: The hostname could not be parsed

I can't figure out how to fix it, and anything else I put in the PortalAlias table simply gets a 'page not found' error. Please help!

 

John Mitchell
Posts:3084



07/30/2007 11:18 AM  

What you are seeing is how it is designed to work.  If the appication cannot match the Url to one of the aliases then it will redirect to the first one.

To put in an alias you should not include the http:// part.  for http://localhost/dnn you should only put localhost/dnn in the alias.

 

sonalij
Posts:24



07/30/2007 11:34 AM  
Ok so in the SQL table I have PortalAlias as "localhost/dnn" and then if I type "http://localhost/dnn" into Internet Explorer I now get a "Page Not Found" page.
John Mitchell
Posts:3084



07/30/2007 11:40 AM  
OK, are you using the localhost address in the browser from the same machine that the website is installed on? If not you will need a different alias to access the remote machine where the website is installed.
sonalij
Posts:24



07/30/2007 11:46 AM  
The website itself is on another server, but I've downloaded a copy of the database and all the stuff onto my desktop, so it should all be here.
John Mitchell
Posts:3084



07/30/2007 11:50 AM  
if you are going to run it all locally then you need to make sure you have a virtual directory setup pointing to the DNN folder in your local web server.
sonalij
Posts:24



07/30/2007 11:54 AM  

Yeah I set up a Virtual Directory. Is it possible that the web.config file isn't set up properly?

This is the configuration and appsettings from it (I don't know if it's showing up properly but can't get the code to paste right)

 


 
 
   
     
     


     

     

     

     

     

     

     

     

     

     

     

     

   
 
 
   

   

   
 
 
   

   

   
   
   
   
   
   
   
   
   
   
 

John Mitchell
Posts:3084



07/30/2007 12:03 PM  
The web.config should work the same either local or remote.

Try this in your browser: http://localhost/dnn/logo.gif

If you get the image then we'll know that the local website is setup ok.
sonalij
Posts:24



07/30/2007 1:10 PM  
I tried the link and do get the dotnetnuke logo.
sonalij
Posts:24



07/30/2007 2:14 PM  

Ok so the link does work, but when I try to go to http://localhost/dnn I get this error:

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UriFormatException: Invalid URI: The hostname could not be parsed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

<pre>[UriFormatException: Invalid URI: The hostname could not be parsed.]
   System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind) +1647210
   System.Uri.CreateUri(Uri baseUri, String relativeUri, Boolean dontEscape) +31
   System.Uri..ctor(Uri baseUri, String relativeUri) +34
   System.Web.HttpResponse.ConvertToFullyQualifiedRedirectUrlIfRequired(String url) +289
   System.Web.HttpResponse.Redirect(String url, Boolean endResponse) +115
   DotNetNuke.HttpModules.UrlRewriteModule.OnBeginRequest(Object s, EventArgs e) +5737
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +64</pre>

Server Error in '/Dnn' Application.

Invalid URI: The hostname could not be parsed.

 

sonalij
Posts:24



08/02/2007 9:14 AM  

I'm just bumping this thread up because I keep getting the same error message. If I change things around I get different ones, but this is the most consistent and the one I keep coming back to when my code seems right.

Currently I have this lines in my code:

and

I tested the connection string in Visual Studio (SqlConnection conn = newSqlConnection(@"Data Source=.\SQLExpress;Integrated Security=True;User Instance=False; Database=Portal;") and it runs through properly, so I think the issue is somewhere else.

When I go to http://localhost/dnn I get the invalid URI message (which I posted in the previous reply in this thread) which I have no idea how to fix/get rid of.

Just to clarify, my Virtual Directory is called DNN, my Database is now called Portal.

John Mitchell
Posts:3084



08/02/2007 9:54 AM  
If you can get into the Database and modify the PortalAlias table you need to make sure that the first PortalAlias entry is:

localhost/dnn

Do not add the http:// part. After you do that you can restart the application (or restart IIS ) and it should work.
sonalij
Posts:24



08/02/2007 11:32 AM  
So I changed it to localhost/dnn (I had localhost\dnn), restarted, and BOOM it worked.

John I want to thank you SO much for all of your help with my many issues. I really appreciate it!
John Mitchell
Posts:3084



08/02/2007 12:25 PM  
Excellent, I'm gald I could help.
Please Register to post a reply.
Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.

Forums >DotNetNuke Support >General-DNN-Help > Invalid URI: The hostname could not be parsed



ActiveForums 3.7
Visit our Store for great DotNetNuke Modules and Skins
DNNMasters Sitemap/Google Sitemap 3.0

Item codeSM3-01
Price$29.00
Product Information 
DotNetNuke CSS NavMenu 3.3 (Developers)

Item codeCSSNM33DEV
Base Price$149.00
Product Information 
Snapsis PageBlaster 3.3.2 for DotNetNuke - Professional Edition

AuthorJohn Mitchell
Base Price$79.00
Product Information