如何通过window.location从文件夹重定向,并在asp.net c中显示警告消息# [英] How to redirect back from folder by window.location with alert message in asp.net c#
本文介绍了如何通过window.location从文件夹重定向,并在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);
推荐答案
使用Server.MapPath获取ScriptManager.RegisterStartupScript或ScriptManager.RegisterClientScriptBlock中登录页面的确切路径方法。
Use Server.MapPath to get the exact path to the login page in ScriptManager.RegisterStartupScript or ScriptManager.RegisterClientScriptBlock method.
Server.MapPath("~/LoginPage.aspx")
>
这篇关于如何通过window.location从文件夹重定向,并在asp.net c中显示警告消息#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文