BreakHead
BreakHead

Reputation: 10672

How to get client Screen Resolution Width/Height at Server Side

I can get client screen resolution using client side script 'javascript',

but I dont want to do that.

I also tried Request.Browser.ScreenPixelsWidth, but it always return fixed width as 680.

Any Idea?

Upvotes: 4

Views: 11831

Answers (2)

MartinDotNet
MartinDotNet

Reputation: 2550

I've just had to do something similar, and what I've done is use Javascript to set a cookie when the user loads the login page, then every subsequent request can retrieve the cookie server side.

The approach is not without it's limitations, but it does provide the information you need for the most part.

Upvotes: 4

Darin Dimitrov
Darin Dimitrov

Reputation: 1039160

Information such as client screen resolution is never sent to the server in the HTTP request so you may forget about it. The only way is to use javascript and then pass this information to the server (AJAX, form post, link, ...). You could also use some proprietary browser plugin like Flash, Silverlight, Java Applet, ActiveX, ...

Upvotes: 14

Related Questions