我正在尝试确保导航栏/父页面已加载到页面顶部,而这最初并未发生。我的下面代码加载了正确的导航栏/父页面,但是这导致整个页面不断刷新/加载。
条目是来自另一个应用程序/服务的查询字符串
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim path As String = HttpContext.Current.Request.Url.PathAndQuery
Dim newOption = cSession.User.p_Option
If newOption = Option.Opt1 Then
Session("lastUrl") = path
Me.ClientScript.RegisterClientScriptBlock(
Me.GetType,
"RedirectScript",
String.Format("window.top.location = '{0}'; ", ResolveUrl("~/userHome/userHome.aspx")),
True
)
End If
答案 0 :(得分:0)
您似乎正在尝试使用某种嵌套页面或框架式布局,或者要确保其他网站没有包装您的内容。如何在您的重定向中添加if
块?
String.Format("if (window.top.location != '{0}') window.top.location = '{0}'; ", ResolveUrl("~/userHome/userHome.aspx"))