簡體   English   中英

如何在asp.net c#中使用帶有警報消息的window.location從文件夾重定向回來

[英]How to redirect back from folder by window.location with alert message in asp.net c#

我嘗試了下面的許多方法,有些是未找到響應資源,有些是無限時間重新加載同一頁面。

ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect", "alert('test 9'); window.location='" + HttpRuntime.AppDomainAppPath + "/LoginPage.aspx';", true);

    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ScriptKey", "alert('Your session timed out.');window.location='../LoginPage.aspx'; ", true);

 ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Your session timed out');window.location.href ='../LoginPage.aspx';", true);

它在 chrome 中對我有用

protected void Page_Load(object sender, EventArgs e)
    {
        ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect", "alert('test 9'); window.location='../Login.aspx';", true);
    }

像下面這樣的語句會起作用,我已經測試過了。 在這個每個“../”是一個后退文件夾。 在我的示例中,“CustomerLogin.aspx”位於當前頁面后面的 2 文件夾中

您可以在 Global.asax 文件或正在構建的實際 url 中放置斷點以獲取生成的確切文件位置。

ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "redirect", "alert('PWD');location.href='../../CustomerLogin.aspx'", true);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM