DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    d_danturthi@hotmail.com Guest

    How to close browser?


    I have an ASP.NET with C# application and want to close browser window with
    click of a button (or link). One can do this with

    Response.Write("<script>window.close()</script>");

    But this does NOT work if the smartnavigation property of the webform is
    set to TRUE.

    Does anyone know how to close a browser window in C# with ASP.NET? Please
    do NOT suggest java scripting/cookie etc. There must be no cookies attached
    and all code is server side. Yeah, it is bad idea but let it go that way
    for now. Thanks in advance.
    SD

  2. #2
    David Rothgery Guest

    Re: How to close browser?


    "d_danturthi@hotmail.com" <vb.@127.0.0.1> wrote in message
    news:3ece9f16$1@tnews.web.devx.com...
    >
    > I have an ASP.NET with C# application and want to close browser window

    with
    > click of a button (or link). One can do this with
    >
    > Response.Write("<script>window.close()</script>");
    >
    > But this does NOT work if the smartnavigation property of the webform is
    > set to TRUE.
    >
    > Does anyone know how to close a browser window in C# with ASP.NET? Please
    > do NOT suggest java scripting/cookie etc. There must be no cookies

    attached
    > and all code is server side. Yeah, it is bad idea but let it go that way
    > for now. Thanks in advance.


    It's not possible without client-side script (like your first try uses). How
    can code that runs on your server tell a user's web browser what to do? All
    your C#/ASP.NET code does is produce HTML, CSS, and JavaScript; IE doesn't
    understand C#.

    FYI - current versions of IE will ask for confirmation if you try to close
    the browser window from script.

    --
    Dave Rothgery
    drothgery@alum.wpi.edu



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links