Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

Is it possible to get a currently open browser window width from Asp.Net C# code behind file without using a single line of code in js or in css?

Thanks in advance
Posted
Comments
DamithSL 26-Dec-14 3:23am    
I don't think it is possible with only server side code but why you need solution with only code behind?
Praveen Kumar Upadhyay 26-Dec-14 5:05am    
Right, even i don't think it will be possible. Because your web server is only bothered with the client that is making the request and nothing else. It can not detect the browser width kind of thing.
SumitChandra 26-Dec-14 5:24am    
So can I write the JScript in cs page? will be ok then?
SumitChandra 26-Dec-14 4:19am    
In my project i cannot use any other js, css and cannot edit anymore in aspx file.
i have access only in cs file. So whatever the changes i can make should be in .cs file

1 solution

You can achieve like this.Just add a reference to System.Windows.Forms.dll

SystemInformation.VirtualScreen.Width
SystemInformation.VirtualScreen.Height



Please refer this link :: http://stackoverflow.com/questions/11628859/how-can-i-determine-browser-window-size-on-server-side-c-sharp[^]
 
Share this answer
 
Comments
SumitChandra 26-Dec-14 6:44am    
SystemInformation.VirtualScreen.Width
SystemInformation.VirtualScreen.Height


This will return screen width and height. I need browser inner width and height

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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