ArrowNuke DotNetNuke Custom Modules Skins and training Home | Site Map | Google Site Map | Login | Register
Arrow Nuke Dot net Nuke Custom DNN Modules DotNetNuke Skinning and training
ArrowNuke DoNtetNuke Custom DNN Modules DotNetNuke Skinning and training
 ArrowNuke Blog Minimize


 Print   
 ArrowNuke Blog Minimize


 Print   
 Child Portals - get rid of the "?alias=" Minimize

Location: BlogsArrowNuke Blog    
Posted by: Ryan Morgan 6/20/2006 11:30 AM

Let's say that on your corporate intranet, you decided to use the childportal feature of DNN. Unfortunately, when you navigate to the child portal at www.myportal.com/child, you get a URL that says www.myportal.com/default.aspx?alias=child. This isn't the end of the world, but it looks all codey.

Boring Background Information
The reason this happens is that child portals are handled initially by IIS. When you navigate to what IIS sees as a child directory with no page associated, the URL Rewriter module never sees it. It looks straight to the file system and when it doesn't see the folder there, we are going to get a file not found error. In order to get around this, the clever folk who created the sub-portal feature, made it so that when you create a child portal, the system actually creates a physical folder in the file system with a default.aspx dropped in to send you back to the main default.aspx with the alias attached as a parameter and viola, the rewriter module picks up the request and we are back in business. Pretty clever, huh?  

Easy Trick
Find the file folder that the child portal creation made (in this case the folder would be called "child"). Inside you will find a file called "default.aspx". Open the default.aspx in notepad and look for the lines of code that say (it should be near the bottom).

            DomainName = ServerPath & "Default.aspx?alias=" & DomainName

            Response.Redirect(DomainName,True)

Remark out the response.redirect line and replace it with a server.transfer call like so:

            'Response.Redirect(DomainName,True)
            Server.Transfer(DomainName,True)

Save the file and navigate to your child portal. Now the location change happens on the server instead of the client and the result is an unchanged URL. If you want to make this change permanent to this installation of DNN and have this be the default behavior for all child portals, you can edit the subhost.aspx file in the /Portals/_default/ folder and make the edit there as this is the file that the framework uses to copy into the created folder.

Have Fun!

Permalink |  Trackback

Comments (3)   Add Comment
Re: Child Portals - get rid of the "?alias="    By Mike L on 3/10/2007 9:30 AM
Fantastic!!!!!

Re: Child Portals - get rid of the "?alias="    By sirlancelotperry@gmail.com on 3/10/2007 9:30 AM
can you use a similar method with Child portals named in this fashion;
http://child1.parentportal.com

Re: Child Portals - get rid of the "?alias="    By host2 on 3/10/2007 9:31 AM
For that you would just create a parent portal with that alias (child1.parentportal.com). As long as you set IIS to pick up all requests on that IP and pass it to your DNN instance, you would be all set. The only real difference between a parent and childportal is the alias. That's why you can turn a child portal into a parent portal.


Your name:
Title:
Comment:
Add Comment   Cancel 

  

2006 Arrow Consulting & Design, Inc   Terms Of Use  Privacy Statement