C# 在默认网站(端口80)和新网站(端口xxxx)下同时托管asp web应用程序的最佳方式是什么?

C# 在默认网站(端口80)和新网站(端口xxxx)下同时托管asp web应用程序的最佳方式是什么?,c#,asp.net,iis,C#,Asp.net,Iis,我已经开发了常规asp web应用程序,将其部署在IIS服务器下,作为与端口xxxx绑定的新网站,然后客户需要在默认网站(端口80)下的web服务器上发布此网站 问题是所有链接和重定向URL都是在母版页中硬编码的,有时是在代码隐藏中 try { Response.Redirect("/Applications/Default.aspx"); } catch (Exception ex) { Helper.LogException(ex); } Response.Redirect(

我已经开发了常规asp web应用程序,将其部署在IIS服务器下,作为与端口xxxx绑定的新网站,然后客户需要在默认网站(端口80)下的web服务器上发布此网站

问题是所有链接和重定向URL都是在母版页中硬编码的,有时是在代码隐藏中

try
{
   Response.Redirect("/Applications/Default.aspx");
}
catch (Exception ex)
{
   Helper.LogException(ex);
}
 Response.Redirect("~/Applications/Default.aspx");
我的问题是,在IIS服务器下,修改代码以两种方式工作的最佳方式是什么 (在默认网站(端口80)下,作为带有保护xxxx的新网站)

比如:

在某些asp页面中,jquery: 函数ShowColorBox(id){


最简单的解决方案是将默认网站的绑定添加到所需的端口。 这可以通过在IIS管理器中单击两次或三次来完成


干净的方法是在需要链接的地方使用~/和runat=“server”。

我解决此问题的方法如下: 1-在母版页中,我写的链接如下

3-在asp页面中: 函数ShowColorBox(id){

//var reqId=name.reqId;
//从隐藏字段获取请求ID
var imageBtn=$(“#”+id);
var requestId=imageBtn.attr('reqid');
//附加颜色框以请求详细信息
颜色框({iframe:true,宽度:“680px”,高度:“95%”,href:“+requestId});
}

我无法更改默认网站的端口,因为它用作internet web服务器(端口80),我必须将我的网站作为新的web应用程序发布到默认网站下(仅~/是不够的,因为您需要编写以下链接:~/WebAppName/…)同时,我不能这样做,因为另一个端口为xxxx的web应用程序运行良好~/表示“当前应用程序”其中包括端口和应用程序名,因此这一点都没有问题。您不必更改默认网站的绑定,但可以添加一个绑定。因此,在默认网站上运行的应用程序将侦听端口80和XX
    //var reqId = name.reqid;
    // get Request ID from hidden field
    var imageBtn = $("#" + id);
    var requestId = imageBtn.attr('reqid');

    // attach color box to Request Details
    imageBtn.colorbox({ iframe: true, width: "680px", height: "95%", href: "/Applications/Requests/RequestDetails.aspx?ItemID=" + requestId });


}
<!DOCTYPE html>
<link href='<%= ResolveClientUrl("~/App_Themes/styles.css") %>' rel="stylesheet" />
<link href='<%= ResolveClientUrl("~/App_Themes/colorbox.css") %>' rel="stylesheet" />

<script type="text/javascript" src='<%= ResolveClientUrl("~/Scripts/jquery-1.7.2.min.js") %>'></script>
<script src='<%= ResolveClientUrl("~/Scripts/jquery.textarea.js") %>'></script>
<script src='<%= ResolveClientUrl("~/Scripts/jquery.colorbox-min.js") %>'></script>
<script src='<%= ResolveClientUrl("~/Scripts/jquery.colorbox.js") %>'></script>
<script src='<%= ResolveClientUrl("~/Scripts/jquery-ui-1.10.2.custom.min.js") %>'>    </script>
<link href='<%= ResolveClientUrl("~/App_Themes/jquery-ui-1.10.2.custom.min.css") %>' rel="stylesheet" />
 Response.Redirect("~/Applications/Default.aspx");
    //var reqId = name.reqid;
    // get Request ID from hidden field
    var imageBtn = $("#" + id);
    var requestId = imageBtn.attr('reqid');

    // attach color box to Request Details
    imageBtn.colorbox({ iframe: true, width: "680px", height: "95%", href: '<%= ResolveClientUrl("~/Applications/Requests/RequestDetails.aspx?ItemID=") %>' + requestId });

}