AS.NET 2.0 detect browser screen size

I am developing an ASP.NET web site that will be accessed by both computer and mobile devices. I would like to make sure the page content is set properly for the browsers screen size. This is of not an issue with computer based browsers but it is with mobile device browsers.

Is there a way to detect the browser window size?

I know I can detect the type and name of the browser so if the size is not detectable is there a list somewhere (webservice or static list)?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The only way I know to check screen resolution is using javascript.
<script language=javascript>
//Get screen resolution variables
var width=screen.width
var height=screen.height"frame.asp?Course=<%= strCourse %>&Width=" + width + "&Height=" + height,"_parent")

Open in new window

Sachintana DissanayakeSenior Web DeveloperCommented:
In ASP.NET you can check in the Browser object and get screen size (width and height) in pixels.

Another property that you can check is maximum size of the page that the browser can handle in bytes.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
With the "Accepted Solution" I get 640 x 480 pixel resolution : Not True .
The problem may be that the solution offered by sachintana returns the screen resolution of the server not the client. This would work if the program was only running on the server but most times this is not the case. The javascript, although not, was the only way I could get the client screen resolution.
Ashish PatelCommented:
If you are planning to detect wide range of mobile phones than please use following free open source .net mobile api

It gives  detailed information of the device making the request and also has the facility to redirect user automatically to mobile landing page when request in coming from mobile device.

For e.g.
Hope this helps.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.