DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Building Scalable Real-Time Apps with AstraDB and Vaadin
Register Now

Trending

  • Redefining DevOps: The Transformative Power of Containerization
  • Building A Log Analytics Solution 10 Times More Cost-Effective Than Elasticsearch
  • How To Design Reliable IIoT Architecture
  • SRE vs. DevOps

Trending

  • Redefining DevOps: The Transformative Power of Containerization
  • Building A Log Analytics Solution 10 Times More Cost-Effective Than Elasticsearch
  • How To Design Reliable IIoT Architecture
  • SRE vs. DevOps

How To Close A Browser Window From A Silverlight Application

Kunal Chowdhury user avatar by
Kunal Chowdhury
·
Aug. 14, 11 · News
Like (0)
Save
Tweet
Share
6.54K Views

Join the DZone community and get the full member experience.

Join For Free

All most all secured sites like bank websites asks you to close your browser window after you signed out from the web application. This is due to high security which actually removes all session details from the browser cache.

If you want to develop the same behavior in your Silverlight application, how will you do this? This post covers the code to implement the functionality of the same. Read to know more.

If you are developing a secured site and want to close the browser window just after the user logout from the application, this small tip will help you. This is not a difficult job to implement. Just a single line of code will do the trick for you.

Use "

System.Windows.Browser.HtmlPage.Window.Invoke()

" method to call the Close() method of the browser window as shown in the below code snippet:


private void OnCloseClick(object sender, RoutedEventArgs e)

{

    System.Windows.Browser.HtmlPage.Window.Invoke("close");

}


The above code when called will close the browser window where your Silverlight application is hosted. If it is a tab, it will close the Window tab instead. If you are using it inside the Internet Explorer, it will confirm you whether you really want to close the browser. If you press "No", it will remain in that page and clicking "Yes" will close the browser tab/window.

 

SNAGHTMLfcd46a3

application

Published at DZone with permission of Kunal Chowdhury, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Trending

  • Redefining DevOps: The Transformative Power of Containerization
  • Building A Log Analytics Solution 10 Times More Cost-Effective Than Elasticsearch
  • How To Design Reliable IIoT Architecture
  • SRE vs. DevOps

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: