Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > detecting client DPI setting in ASP.Net app

Reply
Thread Tools

detecting client DPI setting in ASP.Net app

 
 
Ray Porter
Guest
Posts: n/a
 
      09-24-2009
I've figured out how to detect the client's screen width and height but is
there anyway to do the same for the client DPI setting?

I can do this in a Delphi/Intraweb isapi app but I haven't found how to do
it in C#/ASP.Net.

Thanks,
=================================
Ray Porter
Information Systems
Applications Development Manager
Division of University Advancement
University of North Carolina at Chapel Hill
Phone: (919) 259-9389
Fax: (919) 843-3314
Pager: (919) 216-4218

http://www.velocityreviews.com/forums/(E-Mail Removed)
http://www.unc.edu/~dragon

Meddle not in the affairs of dragons for thou
art crunchy and taste good with ketchup


 
Reply With Quote
 
 
 
 
George
Guest
Posts: n/a
 
      09-25-2009
1. I wonder how you did it with Delphi/Intraweb isapi app

My guess in order to detect DPI you need some executable to sit on the
clients computer
The way it's usually done is using Flash. It's some executable that is
sitting on clients computer but lucky for us almost everyone has it.


George.


"Ray Porter" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I've figured out how to detect the client's screen width and height but is
> there anyway to do the same for the client DPI setting?
>
> I can do this in a Delphi/Intraweb isapi app but I haven't found how to do
> it in C#/ASP.Net.
>
> Thanks,
> =================================
> Ray Porter
> Information Systems
> Applications Development Manager
> Division of University Advancement
> University of North Carolina at Chapel Hill
> Phone: (919) 259-9389
> Fax: (919) 843-3314
> Pager: (919) 216-4218
>
> (E-Mail Removed)
> http://www.unc.edu/~dragon
>
> Meddle not in the affairs of dragons for thou
> art crunchy and taste good with ketchup
>


 
Reply With Quote
 
 
 
 
Ray Porter
Guest
Posts: n/a
 
      09-26-2009
Delphi with IntraWeb allows you to program, for the most part, just as you
would for a desktop app. Intraweb automatically generates any client-side
Javascript code needed to make it all work.

I found the solution myself for Visual Studio. I finally, after hours of
searching, found a site providing fairly complete documentation for the
Javascript "screen" object that exposes various attributes of the client,
including width, height and dpi. The solution is simply to write a little
Javascript snippet in the aspx file to get the necessary values from the
screen object then stick those values in corresponding hidden inputs on the
form. Since I couldn't find a complete, intelligible example anywhere (all
partial snippets), I'll include it here for anyone else who might need it.
I haven't looked closely at the IntraWeb javascript but I imagine it does
the samething -- it just does it for you.

In your C# code, just read Request.Form["ScreenWidth"], etc.

<script type="text/javascript" language="javascript">
var width = screen.width;
var height = screen.height;
var dpi = screen.deviceXDPI;
window.onload = function() {
document.getElementById("ScreenWidth").value = width;
document.getElementById("ScreenHeight").value = height;
document.getElementById("ScreenDPI").value = dpi;
}
</script>

<input type="hidden" name="ScreenWidth" />
<input type="hidden" name="ScreenHeight" />
<input type="hidden" name="ScreenDPI" />

Ray


"George" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 1. I wonder how you did it with Delphi/Intraweb isapi app
>
> My guess in order to detect DPI you need some executable to sit on the
> clients computer
> The way it's usually done is using Flash. It's some executable that is
> sitting on clients computer but lucky for us almost everyone has it.
>
>
> George.
>
>
> "Ray Porter" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> I've figured out how to detect the client's screen width and height but
>> is there anyway to do the same for the client DPI setting?
>>
>> I can do this in a Delphi/Intraweb isapi app but I haven't found how to
>> do it in C#/ASP.Net.
>>
>> Thanks,
>> =================================
>> Ray Porter
>> Information Systems
>> Applications Development Manager
>> Division of University Advancement
>> University of North Carolina at Chapel Hill
>> Phone: (919) 259-9389
>> Fax: (919) 843-3314
>> Pager: (919) 216-4218
>>
>> (E-Mail Removed)
>> http://www.unc.edu/~dragon
>>
>> Meddle not in the affairs of dragons for thou
>> art crunchy and taste good with ketchup
>>

>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Client Site App adding value to a Web App bmntech@gmail.com ASP .Net 3 06-29-2006 04:45 PM
96 dpi x 96 dpi? Boooger Digital Photography 8 11-29-2005 02:46 PM
IrfanView DPI setting? Terry Pinnell Digital Photography 15 07-12-2005 07:46 PM
Detecting DPI setting on client =?Utf-8?B?Um9iQEhU?= ASP .Net 0 08-09-2004 03:17 AM
Should File DPI Match Printer DPI? DS Digital Photography 8 07-06-2004 10:25 PM



Advertisments