Get user screen size in asp.net

Posted on 2003-03-01
Medium Priority
Last Modified: 2009-07-29
How do I find users screen size using asp.net but without using JavaScripts or third party utility?

I need to find screen width and height so that I can present users with different content.

Question by:yunet
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 17

Accepted Solution

dorward earned 200 total points
ID: 8048462
You can't.

By default the browser doesn't send details about the users resolution to servers. The only way to find it out is to run JavaScript (or another client side technology) on the client and then have the user follow a link with the information GET encoded or to submit a form.

I suggest http://www.allmyfaqs.com/faq.pl?AnySizeDesign rather then screensniffing.

Assisted Solution

tncbbthositg earned 200 total points
ID: 8050556
If you want the screen size, you'll have to create an asp page that asks for the height and width and redirect to it.

What you will have is one page which's javascript looks like so:

  <script type="text/javascript">
   funcion redirect(){
    top.location.replace("www.myweb.com/size.asp?height=" + screen.height + "&width=" + screen.width);
 <body onload="redirect()">

then in your asp, retrieve the width and height as if it was in a form.

Hope this helps,
LVL 17

Expert Comment

ID: 10371452
recommendation: Split

Featured Post

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question