Below is a web page created by ASP.NET (VB.NET), but when the image button is pressed, I would like to open html on a completely different site depending on the value of the session variable.(If the session variable is not 2)
How can I move the JS that starts window.open?
The screen does not open below
Protected Sub ImageButton2_Click (ByVal sender As Object, ByVale As System.Web.UI.ImageClickEventArgs)
If Session("UserLevel")<"2" Then
Dim startupScript As String="<scriptlanguage='JavaScript'>window.open('http://XXXXXXXXX/XXXXX/logon.html')</Script>"
Page.RegisterStartupScript("startup", startupScript)
Else
Server.Transfer ("Menu2.aspx")
End If
End Sub
UserLevel
does not change between page display and click.
Instead of deciding where to jump after clicking, why don't you set the link when Page_Load
?
<asp:HyperLink ID="hyperLink1"NavigateUrl="Menu2.aspx"runat="server">
<img src="something.png"/>
</asp:HyperLink>
Protected Sub Page_Load (ByVal sender As Object, ByVal eAs System.EventArgs) Handles Me.Load
If Session("UserLevel")<"2" Then
hyperLink1.NavigateUrl="http://XXXXXXXX/XXXXXX/logon.html"
hyperLink1.Target="_blank"
End If
End Sub
915 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
581 PHP ssh2_scp_send fails to send files as intended
612 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.