Connect aspx to windows forms app - c#

I have an application in C# Windows Forms and I want to add a feature that is available only by jQuery. I implemented what I need in a new aspx file (new project). The question is, how do I connect it with my WinForms app? I need to send some data from my app to the website. These data are contained in a data structure of type Dictionary and I need them in the same format/structure in my website. Can I embed the website inside my form or do I have to call the aspx project from within my app?
Thanks.

You'll have to post the data in some way to the website. Use a WebRequest with the data in the post to send the List data to the website as eg. XML.
Maybe it would be simpler to upload the results to a database and simply open the browser with some ID to point to the database results. (process.Run("iexplore http//website.aspx?id=124)

You can do it if you absolutely need it, see Using ASP.NET Runtime in Desktop Applications, But you are basically trying to attach bicycle pedals to a motor vehicle.
It can be accomplished with a panel with AutoScroll = true

Related

Is it possible to interact with web browser from WinForm/WPF C# App?

I would like to know if it's technically possible to develop a WinForm or WPF C# application that can interact with any web browser tab.
Let's imagine I have a Chrome web page with a web form. I would like to run a WinForm app and be able to point and select a web form field to get the data in it. Exactly like the F12 feature of a browser when you can use the Select feature and use your mouse to select a DOM element.
As shown on attached screenshot.
F12 is a feature within the web browser, but how can I reproduce the same behaviour with an external custom WinForm/WPF application ?
Is it even possible?
I don't think there is a way to achieve what you want to do.
If there was, anyone could write a program to read all of the data you input into your browser, that would be a security nightmare.
yes, you can do it using Selenium.
Check this out: Selenium.

Best way/solution to display json data from a local winform .net app on angularJS web dashboard applicaiton

can u please help me out with the best solution how to do this?
I have a windows form application, which is continuously doing something. (making screenshots and generating data) This app is running locally.
So I dont want to use teamviewer from office just to see what my application is doing. I want to create an AngularJS Web Dashboard application (load it on a webhost) and display this winform data (in form of charts,..), so that I can access from everywere.
What is the best solution for this?
I have experience with AngularJS and parsing JSON-Files from a webserver.
I preffer creating/serialize a json file (each second) from my winform app and load it somewhere on webhost and then access this json file with http.get from my AngularJS application.
Is this a possible solution? Any suggestions?
Thanks!
I agree with making a Angular web app (although you don't need angular for this, you can use jquery to make a simple ajax call, seems like it would be quicker to add the jquery reference than to setup the angular scaffolding just for one or two ajax calls) to call a web request where the winforms app stores the data.
Ex. you can create a web request (or directory save) in winforms app to perform the 'snipping tool' action described here: C# snipping tool service and send the data to somewhere to store it. If the snipping tool doesn't work then probably use an export of the chart or data you are capturing. Then the web app can query that directory to retrieve (ajax/http get) whichever data you need.
I would advise clean up on that directory as it could become quite big if you are saving to it every few seconds or so.

Set ItemSource/DataSource of an AutoCompleteBox in Windows Phone 8 to a database table created in PHPMyAdmin

Two parts to this question
So I've successfully got an AutoCompleteBox working with a local class file called Search.cs I followed this tutorial in order to do so using the IENumerable interface to bind the AutoCompleteBox to the "Search" class file.
Now I'm wondering, is it possible to do the same, except retrieve results from a table found in a Database in PHPMyAdmin on a hosted server? If so, how would I go about doing this?
How do you create get the Search Results to "Do Something", say if I wanted the search result to link to an external webpage via a basic hyperlink, or to another page in-app, what would I have to modify or add in? Any help is much appreciated.
phpMyAdmin is a tool to manage a MySQL database rather than a database itself, so you probably mean you want to connect to a hosted MySQL instance. This is possible, but what you probably want to do is write some server-side software that exposes an API rather that having full database access publicly available.
So then you'll have the server-side application waiting to be called. The Windows Phone application will fire off a request and wait for the response. The server application, when it gets that request, will do all the proper sanitizing of user-input data before running your query on the database and returning the properly-escaped results. How exactly you implement that API is up to your needs. Once the Windows Phone application gets back the response, it can build the page it displays to the user, which, yes, you can include hyperlinks. Make that part of the API response if you store the URL in the database.

Load ASPX page to a windows webbrowser control

Hi I have a Windows form the import data to SQL, also I have an aspx page which is used for previewing data which i need to load to to the windows form using WebBrowser Control, my problem is that How do I pass a collection (List) to the aspx page for it to be able to bind to a gridview?
You can't - they are separate things.
The WebBrowser control simply renders an IE window on your form, loading the requested page and rendering it as usual.
If you want to pass data to the webpage from the web application, you will need to get the data to whichever data source (ie: common database etc) the web app reads from then refresh the web page which will read the new data.
Look at ASP.NET application hosting.
There are a couple of examples already written, so you do not have to re-invent all the glue.
Here is the code I used for IronScheme's 'document browser'.
Here you can see how I setup the server part in a simple console app, but creating a windows forms one is not hard.
As for passing data, you can simply just dump it in the ASP.NET application state, and then read that back from within your ASPX page.

How to access a silverlight control's properties and methods from an aspx page?

I'm developing a web site, and i'm using infragistics for web, but I want to use in some pages silverlight controls (Infragistics too). Is there a way to access a silverlight control's properties and methods from an aspx page?
Thanks in advance for the help.
The silverlight control is running on the client so the best way to access the silverlight's control data is by exposing via javascript methods.
You can map your properites and functions in your silverlight control to javascript methods and then call them as needed.
If you need access the silverlight data server side, then you should expose what you need via javascript and then call the javascript function before a postback and have it write values to a hidden field so that you can then retrieve them server side by accessing the request's posted values.
To expose your some data via javascript just create function in your silverlight page like:
[ScriptableMember]
public int GetValueFromSilverlight()
{
// lame example
return int.Parse(textBox.Value);
}
You could then call this function client side and write it's values to a hidden field which will cause it to post along with the rest of your data.
I asked a similar question a while back when I was working on a silverlight project.
Another thing you could do (which I don't recommend) is to have your silverlight control write back to the application's session or database via web services and then your server side page calls can read the data from whatever location you have written to.
The main point is your need some type of intermediate to get the data back to server so it is accessible and you want something is flexible (hidden field method was my choice).

Categories

Resources