posts - 218, comments - 222, trackbacks - 68

My Links

News




I am a Microsoft Certified Application Developer MCAD Chartered Member (C# .Net) and born in Bangladesh.
I work for Ocean Informatics Pty Ltd as a Senior Developer - Analyst.
I am also co-founder and core developer of Pageflakes (acquired by LiveUniverse) www.pageflakes.com
and most recently created SmartCodeGenerator

My Articles
Flexible and Plugin based .Net Application..
Mass Emailing Functionality with C#, .NET 2.0, and Microsoft® SQL Server 2005 Service Broker'
Write your own Code Generator or Template Engine in .NET
Smart Code Generator .NET: Usage Overview
Smart Code Generator .NET: Architectural Overview
Smart Code Generator .NET: using with NAnt and Cassini

Archives

Free Programming Language Training

Solving DNN deployment issues, Redirecting to localhost and Running DNN in a different port

I was trying to host a small DNN application in one of our Server and I was facing couple of  issues.

Problem 1:
The first problem I faced is it was always redirecting to localhost, whenever I tried http://domain.com/dnn it was redirecting to http://localhost/dnn as a result the site was un-accessible from outside.


Solution

This was easy to solve.
1. I needed to log in as host account.
2. Then I needed to go to the Admin > Site Settings page
3. And finally In the Portal Alias section I added a new Http Alias "domain.com/dnn"

This solved my problem when I hosted the site in port 80.

clip_image002[14]

Problem 2:

Now I tried to host the application in a different port 8080. I.e. http://domain.com:8080/dnn. and somehow when I clicking to redirect to any other page the port started to disappear. The http://domain.com:8080/ automatically turned to http://domain.com/ .

Solution

After googling and looking at the web.config carefully I found, its clearly documented in web.config that

<!-- set UsePortNumber to true to preserve the port number if you're using a port number other than 80 (the standard)
    <add key="UsePortNumber" value="true" /> -->

clip_image002[12]

I tweaked my appsettings section  and added the magic key

<add key="UsePortNumber" value="true" />

Also I had to add a new Http Alias "domain.com:8080"

This solved my problem and started retaining the port for my http://localhost:8080 but not http://domain.com:8080.  The http://domain.com:8080 was still turning to http://domain.com

Note: I later discovered this was not a problem of DNN and the issue happened because of the setup of our router settings and port forwarding, which I'll discuss next.


Problem 3: 
Even after adding the "UsePortNumber" key it did not solve my problem

Solution

Our Router was Port Forwarding all traffic of 8080 to the port 80 of the machine where DNN app is hosted. I.e. 8080 --> 80. As a result even from a browser I as typing http://domain.com:8080 , the DNN Request object was getting http://domain.com and when DNN handlers and url rewriters spitting the reformatted url it was spitting http://domain.com.

This was a big problem for me, initially I thought I would write a HttpHandler for 404 page not found, but soon realized it will never hit the server with the spitted Url so that didn't work. Then I thought I would tweak the DNN handlers to handle this scenario, but later tweaked the IIS and Router to handle this.

1. In IIS I added, support for 8080  to my Default Website.

 

clip_image002

 

2. In Router instead of forwarding to port 80 I started forwarding 8080 to 8080.
3. Made sure that in my DNN Site Settings, I have added Http Alias "domain.com:8080/dnn".

Waaa la, This solved my issue.

Hope this helps and Thank you for being with me so far.

Print | posted on Tuesday, February 19, 2008 5:14 PM |

Feedback

Gravatar

# Domain forwarding

Thanks for being my friend.
You really put together a nice article here.
I am sure you will be an inspiration to many people.I use go daddy code all the time and it really helps to save me money while brainstorming ideas for domains. Other codes in this family include ZINE1 (Save 10% on anything), and ZINE2 (Save $5 off $30).


3/19/2008 7:36 AM | clark
Gravatar

# re: Solving DNN deployment issues, Redirecting to localhost and Running DNN in a different port

Hi..

I had the same problem, did this, but now it keeps redirecting to the same page, that is the main portal page: tabid=36

Any idea?

greetings,

René
5/5/2008 2:58 AM | Rene Vaessen
Gravatar

# re: Solving DNN deployment issues, Redirecting to localhost and Running DNN in a different port

DNN stores portal alias in the DB. Thus, to solve the problem you just need to change the db reccord in the PortalAlias table. Change the HTTPAlias field from localhost to some other (e.g. mywebsite.com).
10/31/2008 4:31 AM | Alex

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 6 and 6 and type the answer here:

Powered by: