Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How can I open or close a browser?

How can I open or close a browser?

Scheduled Pinned Locked Moved ASP.NET
questioncsharpjavascriptasp-netsysadmin
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gyokusei
    wrote on last edited by
    #1

    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)

    M 1 Reply Last reply
    0
    • G gyokusei

      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)

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      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.

      G 1 Reply Last reply
      0
      • M minhpc_bk

        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.

        G Offline
        G Offline
        gyokusei
        wrote on last edited by
        #3

        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!

        M 1 Reply Last reply
        0
        • G gyokusei

          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!

          M Offline
          M Offline
          minhpc_bk
          wrote on last edited by
          #4

          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[^]

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups