简体   繁体   English

如何在asp.net c#中使用带有警报消息的window.location从文件夹重定向回来

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

I tried like below many methodes some are responding resource not found and some are reloading same page unlimited time.我尝试了下面的许多方法,有些是未找到响应资源,有些是无限时间重新加载同一页面。

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);

it works for me in chrome它在 chrome 中对我有用

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

Statement like below will work, I have tested it.像下面这样的语句会起作用,我已经测试过了。 In this each "../" is one step back folder.在这个每个“../”是一个后退文件夹。 In my example "CustomerLogin.aspx" is in the 2 folder back from the current page在我的示例中,“CustomerLogin.aspx”位于当前页面后面的 2 文件夹中

You can put break point in Global.asax file or actual url being constructed to get exact file location generated.您可以在 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