Click here to Skip to main content
15,891,372 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
[HttpPost]
C#
public ActionResult Capture(PrtScreen prt, string command)
{

    if (command == "Save")
    {

         int screenWidth = Screen.GetBounds(new Point(0, 0)).Width;
        int screenHeight = Screen.GetBounds(new Point(0, 0)).Height;
        Bitmap bmpScreenShot = new Bitmap(1920, 1080);
        Graphics gfx = Graphics.FromImage((Image)bmpScreenShot);
        gfx.CopyFromScreen(0, 0, 0, 0, new Size(screenWidth, screenHeight));
        bmpScreenShot.Save("d:\\example.jpg", ImageFormat.Png);

    }

    return View();
}


Keyword "Screen" does not supports
Posted
Updated 29-Jul-15 2:12am
v3
Comments
[no name] 29-Jul-15 7:44am    
Possibly because whatever server you are hosting your web site on does not have permission to write to the root of the C drive. Why would you want a screen shot of the server computer any way?
Sathish km 29-Jul-15 8:12am    
thk u! working .
[no name] 29-Jul-15 8:35am    
Good. But it is only going to work on one computer, your host.
Sathish km 29-Jul-15 8:58am    
what i have to do work in multiple pc's?
[no name] 29-Jul-15 9:56am    
Well if your intent is to take screen shots, for some reason, of the client computer screen, you need some client side code to do that. C# runs on the server, not on the client.

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



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