Getting Browser Window Size for ASP.NET server side code

I want to optimize the display of an ASP.NET page according to the client window area of the Browser. Is there a way to get this?

Thank you
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.

u can get the screen width and height using javascript.

<Script language="javascript">
function getScreenSize()
var screenheight=screen.height;
var screenWidth=screen.width

Open in new window

Sorry i didnt see you wanted Server side code

Another one is


did you get it working.

Let us know if you need additional help
htourignyAuthor Commented:
Page.Request.Browser.ScreenPixelsWidth and Page.Request.Browser.ScreenPixelsHeight always give 640 x 480 and the real size is different. This is true also when request is a postback. I tried with IE 7 and IE 8
The easiest way would be using Javascript because postback processing happens on server side but javascript is executed on client side.


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
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

From novice to tech pro — start learning today.