Daniel Magin’s Weblog

My life in the Developers World

ASP.net Client read out Screen Resolution

First of all, there is no information about the screen resolution in the asp.net classes. But wiht javascript you can read out the resolution and send it back to the server.

Follow this simple steps and you have in your Delphi ASP.net Application the screen resolutions about the clients.

  1. Add in you project a new asp.net page called for example detectscreen.aspx
  2. Change the aspx code to:
    <%@ Page language=”c#” Debug=”true” Codebehind=”detectscreen.pas” AutoEventWireup=”false” Inherits=”detectscreen.Tdetectscreen” %>
    <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”><HTML><BODY>
    <script language=”javascript”>
    res = “&res=”+screen.width+”x”+screen.height
  3. in the detectscreen.pas you change the page_load event to this:
    procedure Tdetectscreen.Page_Load(sender: System.Object; e: System.EventArgs);
            if (Request.QueryString[‘action’] <> ”) then
                Session[‘ScreenResolution’] := Request.QueryString[‘res’].ToString();
  4. for example in your Default Page you like to show in a label the screen resolution. So change the Page_Load event to this:
    procedure TDefault.Page_Load(sender: System.Object; e: System.EventArgs);
      Label1.Text := Session[‘ScreenResolution’].ToString();

That’s all

regards and the European Soccer Championship is now starting, let’s go Germany let’s go 🙂

Daniel Magin


June 7, 2008 - Posted by | Embarcadero (CodeGear) stuff

1 Comment »

  1. Thanks so much for providing individuals with an extraordinarily memorable chance to read from this website. It is always very brilliant plus packed with a lot of fun for me personally and my office mates to search your web site not less than 3 times in one week to see the newest tips you will have. And lastly, I’m just at all times contented with the perfect secrets served by you. Certain 1 facts in this article are clearly the most beneficial we’ve ever had.

    Comment by iphone 4 screen assembly | July 13, 2011 | Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: