C#在新选项卡中打开页面

C#在新选项卡中打开页面,c#,webforms,C#,Webforms,我有以下代码: string urlAccomodation = ar.GetAccommodationHashURL( StudentId.ToString(), sp.GetSysSetting("accomodationSecret"), misc.GetAppSetting("urlAccommodation")); string returnURL = "&url=" + Server.UrlEncode( ar.GetHashURL(

我有以下代码:

string urlAccomodation = ar.GetAccommodationHashURL(
    StudentId.ToString(),
    sp.GetSysSetting("accomodationSecret"),
    misc.GetAppSetting("urlAccommodation"));
string returnURL = "&url=" + Server.UrlEncode(
    ar.GetHashURL(
        StudentId.ToString(),
        sp.GetSysSetting("accomodationSecret"),
        "http://applicants.rac.ac.uk/default.aspx"));
string url = "window.open('" + urlAccomodation + returnURL + "_blank')";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Script", url, true);
我要做的是在一个新标签页中打开一个页面。它在Mozilla和Internet Explorer上运行良好,但Chrome和Safari将在新窗口而不是新选项卡中打开它。 你能帮忙吗?
(我为我的英语道歉)

根据提供的信息不确定,可能不会有任何帮助,但您可能错误地格式化了
字符串url=
行:

string url = "window.open('" + urlAccomodation + returnURL + "_blank')";
试一试


目标应该是
window.open
方法的一个单独参数,例如:
window.open('some.aspx','u blank')

,据我所知,这是浏览器设置,不能从代码控制


我猜它在FF和IE上工作是因为有适当的设置。

请编辑您的问题,使代码格式正确。如何打开页面取决于浏览器。但是,您可以手动更改浏览器的设置。
string url = "window.open('" + urlAccomodation + returnURL + "','_blank')";