Click here to Skip to main content
15,743,541 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i used below code to get Screen resolution

var screen = System.Windows.Forms.Screen.PrimaryScreen.Bounds;
       var width = System.Windows.Forms.SystemInformation.VirtualScreen.Width;
       var height = System.Windows.Forms.SystemInformation.VirtualScreen.Height;

its working fine in local system.when i hosted this code to server its giving different resolution

My local system resolution is 1280x720
Server given resolution is 1024x768

Can Any one help me please urgent.
[no name] 15-Apr-13 13:33pm    
No it is not urgent at all. Of course it is giving you a different resolution. It's whatever the resolution is set to on the server since that is what server side code does, runs on the server.

1 solution

This is wrong approach, probably based on wrong approach to the page design. Instead of trying to develop code for certain screen resolution, you should assume that is is unknown (and the user can change the window size anytime), so, instead of relying on it, you should design the page in a manner highly tolerable to such characteristics.

Please see my past answers:
Image Height and width in inches[^],
Set A Standard Screen Resolution For Web Application[^],
Get Client Machine Resolution in[^],
screen resolution problems.[^],
website display with different view in different monitor[^].

Try to embrace liquid, fluid or elastic Web page design. Please see my past answer:
Webpage screen resolution (Cross Browser\Cross Platform) problem[^].

Good luck,
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900