これは、サイトのルート パスを提供するプロパティです
public static string SiteRootPath
{
get
{
string host = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority);
string appRootUrl = HttpContext.Current.Request.ApplicationPath;
if (string.IsNullOrEmpty(appRootUrl) || appRootUrl == "/")
{
return host + "/";
}
else
{
return host + appRootUrl + "/";
}
}
}
私はこれが好きです
string path = EMS.DAL.DALHelper.SiteRootPath + "Home.aspx";
それから私はこれをします
string script = "<script language='javascript' >alert('User registered successfully');window.location.replace('" + path + "');</script>";
Page.RegisterStartupScript("alert", script);
これによりホームページにリダイレクトされ、localhost では問題なく動作しますが、サイトが公開されている IIS では動作しません。
ページソースを確認すると、これだけが見つかりました「alert('User registered successfully');」スクリプトタグ内??
解決できません。
何か案は ??