WebBrowserControl in c#.net-Alternative Soution - asp.net

I am trying to automate web pages and want to submit a data entry form .
We can do with WebBrowser control perfectly but webbrowser control is a pain to get to work on a production server.
Is there any alternative solution instead of using webBrowser control?
How can I do programmatically this task. I can share you more details if need.

HttpWebRequest would be helpful. You can make a GET or POST request. here is a good example.

Related

HTML Snapshot for google using ASP.net

I have a website which content is created dynamically on the client using ajax, and I want to create a HTML snapshot for google crawler.
Since I Use ASP.net, my idea is to create an instance of WebBrowser control on the server, whenever google passes '_escaped_fragment_' parameter, then load my dynamic page on the server, and then return google the created page.
I have two questions:
1. Is there a better way to do this?
2. If there is no better way to do this, how should I implement it? should I use http handlers?
This may be late. Have you tried NHTMLUNIT(which is a wrapper to HTMLUNIT)?

Webbrowser control in asp.net?

I need to do this:
1) enter a certain website using my clients usernames and pass- they are aware of that offcourse :)
2) navigate inside, a matter of 6 steps
3) download a .csv file from the site
It's a water meter reading site, and I want to update my DB automaticly every hour.
Using WebBrowser in c#, it works great. But, I need it to be on a server and run it all the time for the info to be up to date.
Webservices aren't valid because the reading site has nothing to do with me (3rd side company etc.).
So basically, what I need is to mimic the webbrowser control. what I found unthe codeproject didn't helped me.
I'm checking if CGI can do the trick, but perhaps I'm offtrack here.
thanks for your help!
You can use the HttpRequest/Response objects in the System.Net namespace. They don't mimic the web control but they do allow you to make the requests you want.

Login to asp.net site from another app, then receive filestream

I have an ASP.NET application with pages that use reportviewer. Can someone give me a hint on how to approach the following requirement:
I want to get the report as PDF file from the page, without user interaction. I know I can render the report to a filestream, but since there's no user opening it in a browser, I need to collect the filestream from another application that might run during the night.
There might be other approaches, like a webservice for example that could return the filestream to me, but this would also mean, I have to modify the setup of the datasources that the report receives it's data from. There are a lot of controls on the page, for supplying filter parameters. By using the page life cycle I can use what's already there.
I thought about wget, but haven't tried it yet, and I'm not sure how complicated logging in will be with cookies. I do have full control over the asp.net application though, so if I can modify something there to make it easier, I'd do it.
You can use the "WebClient" in .net application to get the response from the site.
Please refer the below link:
http://msdn.microsoft.com/en-us/library/system.net.webclient(v=vs.80).aspx

Legitamate cross site communication

I am building a website, within a large intranet, that wraps and adds functionality to another site within the same intranet. I do not have access to the other site's source and they do not provide any api's for the functionality they provide. I need to, somehow, have my server-side code go to that site, fill in some forms, then press a submit button.
Is this possible? If so, how can I accomplish this?
Note: I am working in asp.NET if that matters at all.
Not the most efficient, but maybe WatiN can get you started:
http://watin.sourceforge.net/
Just look at the URL the form is supposed to submit to and the method it employs (POST or GET) and then send a request to that URL using the same method and put the field you want as parameters
Your server-side code is basically a web client to the other web site. You will need to write the code to send the HTML form data to the other web site and process the response. I would start with the System.Net.WebClient class. Take a look at System.Net.WebClient.UploadValues. That class/method will enable you to POST the form data to the web site via a NameValueCollection.

Dynamically loading content (ajax) other than using page methods

I'm working on a site at the moment that loads all of its browser popups by using page methods. This approach works but it's starting to get messy. I also view page methods as ways to perform small tasks, username availability comes to mind.
What other options are there besides page methods and the update panel?
You should look at the JQuery ajax functionality. http://api.jquery.com/category/ajax/
You can point the url of the AJAX request to an aspx page or an html page or pretty much any web resource that you like, as long as the request is handled on the server by some kind of HttpHandler. And as long as your callback handler is able to handle and display the returned resource
PageMethods sounding fine to me (which are essentially Webservices).
You could pull more data per request and use cache more. You could build a better JavaScript wrapper which satisfies the need for more tidiness.
You could choose another library: How to call a web service from jQuery

Resources