i am creating an windows application in c#.
in this application i am creating an feed back form for client feedback.
now i want to submit all data this feedback form to my on site.
The the puzzle is that my website is in PHP .
should i go with this combination?
i min c# app and PHP website and sent data via url and grab it on site using GET method, or i need to create a separate website in asp for this action and if you say YES the please tell me .
how to do this action in ASP
thanks
You can simple send a Get/Post-Request to your PHP-Page:
Generate HTTP Requests using c#
and then Read the data via: $Get or $Post.
You can do the same with ASP.Net, via QueryString:
string cParam = Request.QueryString["param"];
Your Website language doesn't really matter as long as you code to get the proper form values. You can use a GET or a POST as well based on type and quantity of data sent across.
You can HTTPRequest and HTTPResponse classes to send response to the Website.
I just got the answer . This question may already have an answer here
pass string from C# Windows Form Application to php webpage
Use Same Data base, and place data from window application and get it from web application
Related
I'm a JS/jQuery developer who's dipping his toe for the first time in the C#/.NET world with a new web service.
There's an external SSO service that I need to communicate with. I send it a URL with some query string parameters, it replies with a URL that includes an SSO token, then I need to pop that URL into the end user's browser.
Any pointers on how to do this with C#?
Some additional info... I'm trying to modify some existing code that sort of did something similar using System.Net.HttpWebRequest/HttpWebResponse and an HTML form with hidden inputs, but I'm a bit lost trying to make sense of what the code is doing, and anyway it uses a form with POST, whereas the SSO service I'm connecting to just uses query string parameters.
Just to close the loop on this, I resolved it by... using JavaScript. Basically the C# code injects some JS to the page to perform the redirect. Probably not be the best way to do this, but it worked...
I developed a website over php that sends and retrieve data from phpmyadmin. Through this way, I want to be able to send data from my smart phone (android) to phpmyadmin and I was told that this can be done through HTTPrequests; however, I was also told that it is possible on asp.net only.
My application (as a test) is built to just register a user and let him/her get logged in. I am just stuck to the point where I am not sure how to send data from the phone to phpmyadmin..
Is it possible to just use asp.net to retrieve and send data
using httprequests and then post them on phpmyadmin? Or do I just redo
my entire website over asp.net?
I have little knowledge about asp.net, but I would just like to hear an opinion from the professionals on this website!
I have very minimal experience with anything web related so apologies if this is a silly question.
I have a Wordpress site with a contact form which users can use to send me a message from the website. The user fills out the form, and it is converted into an email and sent to me.
I would like to have similar functionality from my c# desktop application.
In other words, I am looking for a way to either programmatically invoke the contact form on my website, or to send information to my website, which it will convert into an email and send it to me directly.
What general concepts should I be looking into?
The information typed into the web form is probably sent back to the web server using the HTTP POST method. Essentially the data entered into the web form is converted to name values pairs and sent to the WordPress app. More information on HTTP POST here: HTTP POST (Wikipedia)
To do the same from a C# app, you need to format the data to POST in a similar way and then look at using the HttpWebRequest class. This stackoverflow thread shows an example: HTTP request with POST. If you POST the information to the same URL the web page is using then the server should generate the email.
Just to note as well, if the WordPress app requires you to be logged in before submitting the information, then you'll need to include code to authenticate with the WordPress app within the C# app.
I hope this helps!
How would I go about doing the following...
I want to build a web service for my application to grab a piece of data from an external website, that requires the user to login. The website has no public API , hence the reason for the scraper.
Is there a library to perform the following functions? or what do I do?
automate fill-in form, auto click
Automate submit button
check which URL the user has landed
on, and redirect user to URL
Grab data from label.
EDIT: what im asking for is there a web service, library etc to make it easier to perform screen scraping/automation functions???
Instead of filling a form and virtually clicking buttons, you should look at the source of the form, and figure out how the data is being submitted. In most cases you can simply send a post request with the log in data. If there is something special besides a simple post request, I use this addon to figure out what requests are being done that you can't see. Using C#, I would use the HttpWebRequest class because it handles cookies for you.
If the website does not ban robots, you can use YQL to simulate everything you need. However, it can be a bit difficult or impossible as you basically have to implement a text-only browser within JS.
I have two applications, say app. A and app. B. App A. sends form data (using the post method) to app B. B however, is a web application and uses forms authentication. The post data is send to a webpage (viewdocument.aspx) which is secured by forms authentication. But when the data is send to viewdocument, the login page is displayed because the user isn't authenticated.
The point is, I want the post data to be read by viewdocument. How can I do this?
You can allow all users to access your viewdocument page (by setting authorization in your web.config), get the values of the post in your page load and then, manually do:
if (!User.Identity.IsAuthenticated)
FormsAuthentication.RedirectToLoginPage();
//Else continue with page display
This way, you will protected the display of your page but be able to send data to the page with any user.
I hope it will help
If your web app is only for accept data use web-services.
I think you want to consider separating out the two process - accepting data from another web site, and displaying data to a user. This way the you get nice separation of logic which can improve maintainability. And I'm not sure how you are going to go POSTing data from one website to another as POST should go back to the original webpage. I would do as #Kane suggested in his comment and use a service to accept the incoming data. This could be built to accept the current data, but would also be easily extensible if you ever need to receive data from other sites. Your page for displaying the data would then be a lot more simple and clearer for developers to work on.