fbpx
Skip to content

The KioskSimple Blog

Expert advice for developing, deploying and managing self-service kiosks

  • Try KioskSimple
  • Our Services
    • Kiosk Software
    • Kiosk Consultant
  • About Us
  • Contact Us
The KioskSimple Blog

How to Automatically Log In To an ASP.NET Website Using JavaScript

In this article I’m going to show you how to automatically log into an ASP.NET website running on a kiosk.

This comes in handy when you’re reusing your existing website and want to host it on a kiosk, but want to automate the login process.  Often times in this scenario it doesn’t make sense for the user to log in manually.

KioskSimple makes it easy to securely host your website on a kiosk and automatically log in using a little JavaScript injection.

Automatically log in to your ASP.NET website with JavaScript
Automatically log in to your ASP.NET website with JavaScript

One of the coolest things about this solution is that it doesn’t require any code changes to your website.

You’ll simple create a JavaScript file that will detect if you’re on the login screen and then have it submit your credentials.

The JavaScript file can be hosted on your kiosk or a remote web server.

The following script is a detailed example of how to log in to your website automatically using the KioskSimple JavaScript injection feature.  You’ll want to change the login URL and credentials to match your own.

Chrome Engine Example (Recommended)

Use the following example when using the Chrome Engine (BROWSER->BROWSER SETTINGS->Web Browser = Chrome Engine)

document.addEventListener("DOMContentLoaded", init);

function init() {
    if (window.location.href.indexOf("mywebsite.com/Login/") > -1) {
        if (document.getElementById("txtUserName") != null) {
            // Username
            document.getElementById("txtUserName").value = 'MyUsername';
            // Password
            document.getElementById("txtPassword").value = 'MyPassword';
            document.forms["aspnetForm"].elements["btnLogin"].click();
        }
    }
}

Internet Explorer Example

Use the following example when using Internet Explorer (BROWSER->BROWSER SETTINGS->Web Browser = Internet Explorer)

if (window.location.href.indexOf("mywebsite.com/Login/") > -1) {
    if (document.getElementById("txtUserName") != null) {
        // Username
        document.getElementById("txtUserName").value = 'MyUsername';
        // Password
        document.getElementById("txtPassword").value = 'MyPassword';
        document.forms["aspnetForm"].elements["btnLogin"].click();
    }
}

How to get this example working in KioskSimple

The first step is to download and install the free demo of KioskSimple.

Customize the script to match your website login form

You’ll want to change the following fields to match your login form…

  • Login URL
  • Username
  • Password

If you need help with this please contact us and we can customize the script for you.

Configure KioskSimple to inject your website login script:

  1. Copy the code example above and create a file called AutoLogin.js
  2. Move your script file to the following directory on your kiosk  “C:\ProgramData\RedSwimmer\KioskSimple”
  3. Start the KioskSimple configuration app.
  4. Select the BROWSER left menu
  5. Select JAVASCRIPT
  6. Under JavaScript Injection URL enter the path of the credit card script “file:///C:/ProgramData/RedSwimmer/KioskSimple/AutoLogin.js”
  7. Save your settings

Configure KioskSimple to run your website:

  1. Select the BROWSER left menu
  2. Select BROWSER SETTINGS
  3. Under Start-up Web Page enter the URL of your website to run in kiosk mode
  4. Save your settings and close the configuration app

Start KioskSimple in Test Mode

You should see the login page appear briefly and then the user should automatically be logged in.  It’s as easy as that!

Got Questions?

tech support for auto logging in to your websitePlease contact us if you need help customizing the website login script to match your login form.

We also offer free phone and email technical support for all of our code examples.  Try finding that anywhere else in this industry.

We’re dedicated to making your next kiosk project a success and are happy to hold your hand through the process.

  • Author
  • Recent Posts
Andrew Savala
Follow me
Andrew Savala
CEO at RedSwimmer Inc.
Andrew Savala is the CEO of RedSwimmer, with a background in designing and deploying complex payment kiosk systems.Andrew offers high-value, strategic consulting services to companies looking to develop their payment kiosks.
Andrew Savala
Follow me
Latest posts by Andrew Savala (see all)
  • Kiosk Idle Timeout: What Happens When They Walk Away… - May 25, 2019
  • How to Plan Your Payment Kiosk Workflow - May 4, 2019
  • Selecting Kiosk Payment Devices, Don’t Paint Yourself into A Corner - April 25, 2019

Author: Andrew Savala

Andrew Savala is the CEO of RedSwimmer, with a background in designing and deploying complex payment kiosk systems. Andrew offers high-value, strategic consulting services to companies looking to develop their payment kiosks. View all posts by Andrew Savala

Author Andrew SavalaPosted on September 24, 2015May 11, 2016Categories Developer, GeneralTags JavaScript Auto Login, Kiosk Security, Kiosk Software, Website Auto Login

Post navigation

Previous Previous post: How to Put Your PowerPoint Presentation on a Kiosk
Next Next post: Touchy Subject: Touchscreen Technology Bringing the World to Our Fingertips

Follow Us

Follow KioskSimple on FacebookFollow KioskSimple on TwitterFollow KioskSimple on LinkedIn

Subscribe to Our Newsletter

Check your inbox or spam folder now to confirm your subscription.

Recent Posts

  • Kiosk Idle Timeout: What Happens When They Walk Away…
  • How to Plan Your Payment Kiosk Workflow
  • Selecting Kiosk Payment Devices, Don’t Paint Yourself into A Corner
  • Get to Market Faster with An MVP Kiosk
  • Kiosk Hacking: 8 Tips to Harden Your Kiosk Security

Archives

  • May 2019
  • April 2019
  • March 2019
  • November 2017
  • October 2017
  • June 2017
  • May 2017
  • February 2017
  • January 2017
  • December 2016
  • November 2016
  • July 2016
  • June 2016
  • May 2016
  • December 2015
  • November 2015
  • September 2015
  • August 2015
  • July 2015
  • June 2015
  • May 2015
  • April 2015
  • March 2015
  • February 2015
  • January 2015
  • December 2014
  • November 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • Try KioskSimple
  • Our Services
    • Kiosk Software
    • Kiosk Consultant
  • About Us
  • Contact Us
The KioskSimple Blog Proudly powered by WordPress