I m looking for some code to enter data in another website without API,
Front end should be my website and in back end automatically the data enters in the another website and get revert from there and give me the message/proper content in my website..
So is there any type of code is available for that in c#??
Guys please suggest me if there is any way to do this.
I tried some web services but it didn't helped.
Just a suggestion : You can have a single database for both of your web sites. from one site you can insert the data and you can use other website to retrieve it.
Related
I have a scenario where I would like to automate programmatically the following process:
Currently, I have to manually
Navigate to a webpage
Enter some text (an email) in a certain field on the webpage
Press the 'Search' button, which generates a new page containing a Table with the results on it.
Manually scroll through the generated results table and extract 4 pieces of information.
Is there a way for me to do this from a Desktop WPF App using C# ?
I am aware there is a WebClient type that can download a string, presumably of the content of the webpage, but I don't see how that would help me.
My knowledge of web based stuff is pretty non-existent so I am quite lost how to go about this, or even if this is possible.
I think a web driver is what you're looking for, I would suggest using Selenium, you can navigate to sites and send input or clicks to specific elements in them.
Well, I'll write the algorithm for you but you also need to some homework.
UseWebClient get the htm page with the form you want to auto fill and submit
Us regex and extract the action attribute of the form you want to auto submit. That gets you the URL you want to submit your next request to.
Since you know the fields in that form, create a class corresponding to those fields, let's call the class AutoClass
Create a new instance of your auto class and assign values you want to auto fill
Using WebClient to send your new request with the url you extracted from the form previously, attach your object which you want to send to the server either through serialization or any method.
Send the request and wait for feedback, then further action
Either use a web driver like Puppeteer (Selenium is kinda dead) or use HTTPS protocol to make web requests (if you don't get stopped by bot checks). I feel like your looking for the latter method because there is no reason to use a web driver in this case when a lighter method like HTTP requests can be used.
You can use RestSharp or the built in libraries if you want. Here is a popular thread of the ways to send requests with the libraries built in to C#.
To figure out what you need to send you should use a tool like Fiddler or Chrome Dev Tools (specifically the Network tab) to see what you need to send to acheive your goal as you would in a browser.
This is my first time developing this kind of system, so many of these concepts are very new to me. Any and all help would be appreciated. I'll try to sum up what I'm doing as efficiently as possible.
Background: I have a web application running AngularJS with Bootstrap. The app communicates with the server and DB through a web service programmed using C#. On the site, users can upload files and reference them later using direct links. There's no restriction to file type (yet), so just about anything is allowed.
My Goal: Having direct links creates a big security problem for me, since the documents/images are supposed to be private data. What I would prefer to do is validate a user's credentials when the link is clicked, then load the file in the browser using a more generic url path.
--Example--
"mysite.com/attachments/1" ---> (Image)
--instead of--
"mysite.com/data/files/importantImg.jpg"
Where I'm At: Not very far. My first thought was to add a page that sends the server request and receives a file byte stream along with mime type that I can reassemble and present to the user. However, I have no idea if this is possible using a web service that sends JSON requests, nor do I have a clue about how the reassembling process would work client-side.
Like I said, I'll take any and all advice. I'd love to learn more about this subject for future projects as well, but for now I just need to be pointed in the right direction.
Your first thought is correct, for it, you need to use the Response object, and more specifically the AddHeader and Write functions. Of course this will be a different page that will only handle file downloads, so it will be perfectly fine in your JSON web service.
I don't think you want to do this with a web service. Just use a regular IHttpHandler to perform the validation and return the data. So you would have the URL "attachments/1" get rewritten to "attachments/download.ashx?id=1". When you've verified access, write the data to the response stream. You can use the Content Disposition header to set the file name.
I'm currently in the process of building a forum like site where people can register and login to their own page to post content.
I have built the system to send off a verification link to the registrants email along with a link that contains their user user id which is their email on the URL
http://localhost:50490/ForumTest/ActivateProfile.aspx?Username=jason90#yahoo.co.uk
I need to know how I can get my SQL database table [UserTable] field UserVerified to update to "1", it is currently set to "0" by default.
I just need to know how to write the code behind the ActivateProfile.aspx page to update this data field when the Users hit the Activate button on this page.
Would be awesome if someone can help me with this
I have been trying to find solutions everywhere but its all based on examples that were made using the CREATE USER WIZARD on the Microsoft Visual Studio environment. all my forms and fields have been made manually therefore those example were of no use for me :(.
Hope someone can help me
Thanks a lot in advance
:)
Do you have an existing Database connection? You need to execute some SQL similar to this:
UPDATE UserTable SET UserVerified=1 WHERE Username='jason90#yahoo.co.uk'
I want to grab a set of data from a site into my C# application. I've referred to some sites and articles using the WebClient class.
But the problem is the data I want is in a news bar made using flash. Is it possible to grab the data from it? The data in it also keeps on updating as well.
Have you tried the Yahoo approach? The below project does just that.
It is easy to download stock data from Yahoo!. For example, copy and
paste this URL into your browser address:
http://download.finance.yahoo.com/d/quotes.csv?s=YHOO+GOOG+MSFT&f=sl1d1t1c1hgvbap2.
Depending on your Internet browser setting, you may be asked to save
the results into a filename called "quotes.csv" or the following will
appear in your browser:
http://www.codeproject.com/KB/aspnet/StockQuote.aspx?display=Normal
It is unable to grab a data from Flash.
One possible solution is that, if you dig into embed tag at the Flash object or find some url or rss that looks to be consumed by the flash, you can read that by WebClient or (hopefully) XmlReader.
I have deployed the web application and customer accessing web application publically in between my databse down then I want show the custom message to the user. In my web application 50 pages, and I want to handle message commonly for all pages. Please help how to do this.
You can configure a section in web.config that tells ASP.NET/IIS to redirect users to a set of static or dynamic pages in case of common errors.
Check out this article - http://www.asp.net/hosting/tutorials/displaying-a-custom-error-page-cs
The scenario is pretty similar - something goes wrong with the SQL DB call and you dont want to display an ugly error.
Make sure to include some sort of logging somewhere so that you know these errors are happing, however. One plus side of ugly error messages are that you'll hear about them right away ;)