screen resolution detection

G

Guest

After exhausting my search on the MS website, I can't find a straight answer.
I fin dit hard to believe that MS left our something so useful in ASP.NET as
screen resolution detection.

Problem:
I would like to detect, get values for, the screen resolution in px but in a
code behind. Is this possible?

There is a System.Windows.Forms.Screen class for the Windows client side,
why are there none for browser/ASP.NET client?

thank you.
 
J

Jon Skeet [C# MVP]

Chris said:
After exhausting my search on the MS website, I can't find a straight answer.
I fin dit hard to believe that MS left our something so useful in ASP.NET as
screen resolution detection.

Problem:
I would like to detect, get values for, the screen resolution in px but in a
code behind. Is this possible?

There is a System.Windows.Forms.Screen class for the Windows client side,
why are there none for browser/ASP.NET client?

Because browsers don't generally (AFAIK) pass the screen resolution in
requests?
 
G

Guest

So we are reduced to client side Javascript. Can those values be accessible
via the ASPX page code behind? I use VB.

I know that products like Browser Hawk access them and make available that
information via their objects. So there must be a better way to do this.
 
P

Patrice

You could get the value client side using js and pass the value as an hidden
field.

Do you want to use this value for something else than statistics ?

Patrice
 
G

Guest

pass via hidden field? Using to update the attribute of a button to open a
new window (page) in a certain size based on user screen resolution. I've
found that the Javascript window.open uses only pixels and that I'd rather
use percent % since screen resolution has not been determined but JavaScript
window.open does not allow that.
 
P

Patrice

If you really need you could likely open the window with whatever size you
want and resize the window once opened. This way you won't need this info
server side. I believe we have done this once.

Patrice

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top