Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 433
  • Last Modified:

How to block mobile or smartphone browser access for clock in/out functions in asp.net

We've created a clock in/clock out page built using asp.net in vb, and we are trying to see how to add controls to block it for users trying to access the page on mobile browsers or outside networks.

We know we can restrict it to a single IP address, however, the organization the IP belongs to frequently changes their network IP  (as we've been told).

Any code set would be of help.

Please let me know if you have any further questions.

3 Solutions
One option is to look at the user agent string. But it could be faked on droids.
Roopesh ReddyIT AnalystCommented:

Try this website - http://detectmobilebrowsers.com/

Hope it helps u...
A really simple trick would be to create a style sheet rule after all your other CSS data that hides the page for mobile devices.  Like this...

	<style type="text/css" media="screen">
	  normal CSS stuff here...
	<style type="text/css" media="handheld">
		body { display: none; }
		html { display: none; }
		input { display: none; }

Open in new window

I haven't actually tried this, and it MIGHT affect a few handheld devices such as tablets, but its no worse than checking for a user agent string, which as CodeCruiser rightly points out could be easily faked.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now