I am looking to make Greenshot take an IE screen shot from the code behind of a C# Web Form. How can I call Greenshot from my server or code running in the browser and have it take a screenshot on the client's machine?
The code behind of a web form (or really, any code behind in ASP) is run on the server. The server cannot directly run code on a client (it can, of course, inject javascript into its responses).
So no, you won't be able to do this in the manner you describe. However, if a given page had JS that performed this task for you on page load (or on a button click, or whatever), you could likely get a similar result.
Looking at Greenshot it looks like that is a program that is run on the client's computer, so this is even more impossible as the browser sandbox isn't going to let JavaScript run that application. There are possibly other ways to get an image of the rendered content in JavaScript, but that approach seems very unlikely to work.
Related
I would like to know if there is a technique or solution for the follow problem.
I have a software application that is currently running inside of a Microsoft RDP session. I have some help resources built into it in which some of them open up on a webbrowser. Some of them are YouTube videos. The problem is taht through organisational policies, they cannot open YouTube clips within the RDP which connects to a interstate server.
What I would like to do is instead open up a webpage outside of that RDP connection on the local host computer instead, which does not have any restrictions like opening up YouTube webpage to play video clips.
Can you please suggest a technique, utility or solution to this problem?
Thanks,
Colin.
The nicest way to do this would probably be to create a dynamic virtual channel plugin for RDP: https://msdn.microsoft.com/en-us/library/bb540859(v=vs.85).aspx
You would have a server-side component registered to handle the protocols (http/https, I assume) you want to redirect back to the client, possibly with some filtering logic if you still want a few to run server-side (such as intranet sites); then a client-side mstsc plugin whose only job is to call ShellExecute on the URLs you pass back.
Piggybacking on clipboard redirection might be less code, but it obviously has side-effects - e.g it obliterates anything else the user might have had on the clipboard.
I'm making an application on c# for signing PDFs. Its works perfectly on my visual studio web project, but when I publish it on my test server it throws me this Error
In this case I'm trying to execute the code that sign a pdf on the server and the error occurs specifically on the line:
System.Security.Cryptography.Pkcs.SignedCms.ComputeSignature()
It is supposed to throws a window on your desktop asking for your certificate (reading a smart Card) and then asking for your PIN just like this
Windows Security Window but I have the hunch that it's not possible because Its implies that the server have to have the possibility to interact with the client's desktop
Ok, now that I've explained all the enviroment that I'm facing, here are the solutions I've tried until now:
1) Trying to correct the Server Error above: I went in the server to IIS>application Pool>MyPage>Advanced Settings>Process Model>Load User Profile and selected True instead of False (Didn't Work)
2) Still trying to correct the Server Error I Went to Computer Management>Services and Application>Services and turned on the service "Interactive Service Detection" (Still not working and doesn't work even if I do the same on the client computer)
3)Finally, I guess that it's not possible to run the code on the server because the Error line above is a native calling of Windows Security so I thought: what if I try to run the code right from the client?. Like a c# applet equivalent or something, well... there are two ways for do that: ActiveX (old technology) and Silverlight (newer). The thing is that I just can't make a simple Silverlight program start on chrome, it does on firefox and IE but if doesn't work on chrome is a totally waste so my last option is to make it run with an ActiveX, and there is almost none useful information in the internet about that
If someone can tell me what to do, either to correct the error or to make my program run from the client side, I would be so grateful
You can't call the system's api from a Web client as this would break the sandbox. If you must use that system call, create a wrapper on the server that will handle the popup, although this would be a very "hacky" solution. You should really be asking why I am trying to use a Web client interface if I must use said native system call.
I m trying to do following with c# code.
1) Open Firefox Browser --->Tools--->Options--->In General Tab--->Downloads--->Always ask me where to save file.
I want to do this whole process in my application with c# code. I want that when download window opens , the radio button in "Always ask me where to save file" option gets checked automatically.
I got the code from this site ..but that works only when firefox in not running. I m using the code in application and running that application in Firefox browser.
I have tried from various links , but all is in vain. Any help will be greatly rewarded. Thanxxx in advance..!!
If by "and running that application in Firefox browser" you mean you've written an ASP.NET web app, I highly doubt you're going to be able to do this. It would probably be considered a security flaw in Firefox if it allowed a web page to change this setting.
You could try modifying the code here. But that code will only run on your machine or in your own program that you can distribute. Like said in the other answer you will not be able to run this from the browser. This sounds like something that was done with ActiveX but that´s no longer supported by Firefox.
Overview
C# File - Users PC
PHP Server - Hosts Webpages for application
Server and Users PC on local network
I have a c# file that reads weight from a USB scale. How would I trigger this file to run so it feeds into my program. The problem is I am using PHP to host our webpage/application so its not running client side and the scale is not hooked up to the server but to the clients PC.
The C# script would have to be on the clients in order to read the scale so how would I trigger this to happen?
Is this even possible and if not what would be a better way?
Important Edit
I was able to run the Scale Script (C#) when I wanted by having PHP and C# use TCP sockets.
The C# would listen for PHP to send something and when it did it would read the scale and send this information back to PHP becuase PHP was listening for a response. Mixed in with a little Ajax and it updates in the web browser.
Gave Chris Credit because he was the most helpful with answering my questions
It sounds like what you really want is for the client application to submit the data to the website itself, and the most suitable approach is probably to expose a web service from your server.
This service should accept weight data, along with some sort of customer key or whatever, to correlate the records correctly on the server side. I've never created a web service in PHP personally, so I can't give any advice on the implementation of that, but it is fairly trivial to hook a C# client app up to a web service once you've exposed its metadata (assuming you use SOAP).
you can't start C# application from a web page in a way that'll work in every browser every time. BUT, you can have some workarounds:
Use ActiveX component that read the data in the client and upload it to the server. the biggest cons is that it'll only work in Internet Explorer
use Silverlight client application that runs on elevated mode (v4) and upload the data to your server.
refer your clients to download application (the C# application you wrote about) and run it - this application will upload the data to your server.
hope this helps.
C# isn't a scripting language, it's a language that compiles into executable binaries or libraries. You won't be able to execute C# code on the client's computer via a website because C# code needs to be compiled before it can run.
Presumably what you really want is for your compiled C# binary to be executed on the client's machine via your website. You won't be able to easily do that. There are a lot of security measures in place to prevent browsers from running programs on your computer. There may be ways to hack around these security measures by using plugins (such as ActiveX), but it's not something that will be a one-liner.
Edit: I think you need to step back and think about what you're trying to do in a broad sense. You're trying to create a website that can read information from a user's USB port. This is the type of thing that browsers are designed to prevent, and for good reason. I wouldn't want random websites to be able to access peripheral hardware without my explicit permission. If you want this website to function the way you're expecting, you're going to have to seriously think about the security implications. You'll need some kind of client-side code (ActiveX, Silverlight, ...), and the user will need to explicitly give permission to for this all to happen. It won't be easy, and it won't be automatic. And I'm damn glad that's true.
I want to get "PrintScreen" of Client PC when he access a particular Web Page.
I tried GOOGLEing this IDEA! but was unable to get much,
Infact what i got know on stackoverflow itself is Javascript PrintScreen
JavaScript cannot be used for such functionality.
So, I would like to know can it be done in Ajax,ASP.NET with C#/VB or in PHP
because at the end i want to save this image/s continously to database either SQL Server or MySQL or Oracle.
Is this feasible by ActiveX Objects?
To my knowledge, it will be difficult to go ahead with javascript.Yet i plan to use more of client resourses than server resources while executing this functionality.
Browsers do not have access to client computer resources. What you describe there can't be achieved without a third party dll (if you mentioned .Net) installed on your computer and that can be done only on demand by the client. But the whole idea is, as stated before a privacy invasion and any attempt to install anything on the client computer will be regarded as a security threat from any AV software.
Simply NOT Possible by the why you need this ?
I don't know "JavaScript cannot be used for such functionality" before. But since you have figure it out, I can tell you that ASP.NET can't help you on this if JS can't. Because all ASP.NET at client side is javascript. Ajax things are actually working through javascript. ASP.NET just generates those javascripts for you to make your code working like a WebForm.