How can I open or close a browser?
-
In Javascript, I used this method: window.open("homepage.aspx") to open my home page, but in ASP.NET I dont know how I can do that? And I have to use which method to close it. (runat server)
You should be awared that the server side code (runat=server) can execute tasks only on the server. So to perform a task on the client machine, such as opening/closing a browser, the code needs to run on the client side. In ASP.NET you can use javascript or vbscript to open/close a browser as normal:
window.open(...); //Open a new browser.
window.close(); //Close a browser.For more information, you can see the "Client Script in Web Forms Pages" section in MSDN.
-
You should be awared that the server side code (runat=server) can execute tasks only on the server. So to perform a task on the client machine, such as opening/closing a browser, the code needs to run on the client side. In ASP.NET you can use javascript or vbscript to open/close a browser as normal:
window.open(...); //Open a new browser.
window.close(); //Close a browser.For more information, you can see the "Client Script in Web Forms Pages" section in MSDN.
Now I show you my problem: I have a login.aspx page, when someone logged in, I will check their information. If it valid, I will open mission.aspx page which use frameset (there are 2 frames). Otherwise, I will redirect to login page. However, if someone directly open mission.aspx page, how I can solve this problem. If I redirect to login page, it doesnt work (maybe mission page use frameset). Please help me! Thank you very much!
-
Now I show you my problem: I have a login.aspx page, when someone logged in, I will check their information. If it valid, I will open mission.aspx page which use frameset (there are 2 frames). Otherwise, I will redirect to login page. However, if someone directly open mission.aspx page, how I can solve this problem. If I redirect to login page, it doesnt work (maybe mission page use frameset). Please help me! Thank you very much!
Hi there, I think it's just a configuration issue. You can try to set the authentication of your application in Forms mode. Then the unauthenticated user will be automatically redirected to the login page. For more information on how to configure that, you can see in MSDN: ASP.NET Authentication[^] Forms Authentication Provider[^]