[英]Passing data from a javascript function in my remote website to a c# application on my desktop application
I have a dynamic program. 我有一个动态程序。 These are the steps that the program follows. 这些是程序执行的步骤。
i) I have a windows form application and I have divided the window into two parts. 我)我有一个Windows窗体应用程序,我已将窗口分为两部分。 One part contains a ChromiumWebBrowser where it loads a remote website (like www.abc.com). 其中一部分包含ChromiumWebBrowser,可在其中加载远程网站(如www.abc.com)。 The other part does normal operations of fetching data from a wampserver MYSQL DATABASE installed on the local computer and gives output on the same window division. 另一部分执行正常操作,从本地计算机上安装的wampserver MYSQL DATABASE获取数据,并在同一窗口分区上提供输出。
ii) Now I use the Chromium web browser to import data from the remote website and send it to a local php file in the local wampserver and then inside the php file I send the data to appropriate local database tables. ii)现在,我使用Chromium Web浏览器从远程网站导入数据,并将其发送到本地wampserver中的本地php文件中,然后在php文件中,将数据发送到适当的本地数据库表中。
iii) When the remote website loads, there is a button "Import data" and then this importation is processed via an AJAX call and now it is in the ajax success: function(){ } that I send the data to my local php file. iii)加载远程网站时,有一个“导入数据”按钮,然后通过AJAX调用处理此导入,现在在ajax成功中:function(){},我将数据发送到本地php文件。 (I have control over both remote and local wampservers) (我可以控制远程和本地wampserver)
iv) NOW MY QUESTION IS how do I pass the data from the external javascript ajax to my c# application so that I don't need to have the local php file ie The received data will be sent to database directly from c# iv)现在我的问题是如何将数据从外部javascript ajax传递到我的C#应用程序,这样我就不需要本地php文件,即接收到的数据将直接从c#发送到数据库
v) And are there any security threats in the process? v)在此过程中是否存在任何安全威胁?
I hope I'm was clear, Any suggestions are welcome 希望我很清楚,欢迎任何建议
Easiest option is to implement a custom scheme
. 最简单的选择是实现自定义scheme
。 So for example you would make your requests to custom://ajax/uploadToDatabase
. 因此,例如,您将向custom://ajax/uploadToDatabase
发出请求。 You can then parse the request, update the database and respond accordingly. 然后,您可以解析请求,更新数据库并做出相应的响应。
http://rawgit.com/cefsharp/CefSharp/master/CefSharp.Example/Resources/Home.html#features-custom-schemes http://rawgit.com/cefsharp/CefSharp/master/CefSharp.Example/Resources/Home.html#features-custom-schemes
https://github.com/cefsharp/CefSharp/blob/cefsharp/45/CefSharp.Example/CefSharpSchemeHandler.cs#L51 https://github.com/cefsharp/CefSharp/blob/cefsharp/45/CefSharp.Example/CefSharpSchemeHandler.cs#L51
The CefSharp.WinForms.Example
and CefSharp.Wpf.Example
projects both provide a working implementation. CefSharp.WinForms.Example
和CefSharp.Wpf.Example
项目均提供了有效的实现。 They're available on GitHub
它们在GitHub
上GitHub
https://github.com/cefsharp/CefSharp https://github.com/cefsharp/CefSharp
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.