I have a situation where I have a test server running on my home network. I was using it to host just one application but when I wanted to do so with 2 or more, I ran into a problem because external URLs could only be redirected to the root folder.
After some experimenting I found a simple solution that seems to work very well:
- In the root of Inetpub/wwwroot either remove "default.htm" or change the priority order so that "default.aspx" appears first.
- Install into this root folder the two files shown below, Default.aspx and Default.aspx.cs
- Then with your IP redirection, use this format: http://your_local_IP_address?app=folder_name - Example: http://220.127.116.11?app=MyTestApp
It's not perfect in that it requires one to add the "app" parameter & value but other than that, it works well. If someone has a simpler solution, I'd love to see it!
Here's the contents of the two required files:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<form id="form1" runat="server">
public partial class _Default : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
string targetFolder = "/MyMajorTestApp"; // Default app to run, in case not "app" parameter is provided
if (Request.Params["app"] != null)
targetFolder = "/" + Request.Params["app"];