Save page with Web Browser Control with JS and CSS files - c#

I have a Web Browser Control in windows application. I want to save page at specific folder with CSS files and JS files. I have used webBrowser1.ShowSaveAsDialog() method but by this user can save page at any location instead of my application folder.
So, how can I save pages with folder structure to my location without showing pop up menu?

Good question!! all the browsers do it, iMacros ($495-$990) does it
Selenium, phantomjs, slimer, watir, etc CAN'T do it,
the closest i have seen to that sort of functionality is...
http://www.codeproject.com/Articles/2847/Automated-IE-SaveAs-MHTML
which uses c++ to hack the save as dialog.
You'd think that SaveAs webpage complete would be just another
method on the browser control. But it doesn't seem so. I want
this functionality as well -- sorry this question remains unanswered.

Related

Upload files without full page postback

The Plan
I need to upload a file without causing a full page refresh.
The uploaded files should be stored in a temporary place (session or
cookies).
I will only save the files in the server, if the user
sucessfully fills all the form fields.
Note: This is one of the slides of a jQuery slider. So a full refresh would ruin the user experience.
The Problem
If I place a Fileuploader Control inside a AJAX Update Panel, I wont be able to acess the file on the server side.
Note:From what I have found so far, this happens due to safety reasons.
Can't be done without co-operating binaries being installed on the
client. There is no safe mechanism for an AJAX framework to read the
contents of a file and therefore be able to send it to the server. The
browser supports that only as a multipart form post from a file input
box.
The Questions
When storing the files in a temporary location, should I use session or cookies? (what if the user has cookies disabled?)
If preventing a postback, really is against the standarts of user safety. Will it harm my website reputation? (regarding SEO and such)
Which road to take?
C# ASP.Net with AJAX? (is there a workarround?)
C# ASP.Net + AJAX Control Toolkit? Does it helps? (using the AsyncFileUpload control)
C# ASP.Net + jQuery Control? (won't I have problems fetching the data from the JavaScript?)
C# ASP.Net + iFrame? (not the most elegant solution)
The total amount of cookies that you can use is limited to a few kilobytes, so that's not a viable option to store a file. So sessions would be the only remaining. Consider also to save the file in the file system and remove it if it's not going to be used, as storing files in memory (session) will limit how many users you can handle at once.
No, for functions like uploading files you don't have to worry about that. Search engines doesn't try to use such functions when scanning the page.
You can use an AJAX upload in browsers that support direct file access, but there is no way around doing a post if you need to support all browsers. However, the post doesn't have to end up loading a new page, you can put a form in an iframe, or point the target of a form to an iframe.

How to give Csharp Webbrowser default Path to download files

I am making a web browser in C Sharp, I want that all the files downloaded by the user on this web browser from any web sites, web browser saves it in one default folder (i.e C:\Users\Abc\Downloads)
Currently when i try to download file from any url it pops up a dialogue box asking for path, and it is annoying thing to have so i just wants to give one default path where it just saves the file automatically without asking user for the path.
Like we have default download path for Mozila firefox and google whenever user download any file from the web browser it saves in one default folder. so how can I achieve this in .net 4.0 Csharp web browser.
I'm afraid you can't with the webbrowser control,
maybe take a look at
http://www.mono-project.com/WebBrowser
first you don't use IE, and you can do more if I'm right
Regards,
Corné
If you're using the WebBrowser control in c# this can be somewhat of a challenge, but have a look at this link which might help you, I've tried it myself with good results.
http://www.codeproject.com/Articles/31163/Suppressing-Hosted-WebBrowser-Control-Dialogs
Good Luck! :)
Edit:
You might want to look into this solution to your issue as well:
Automated filedownload using WebBrowser without url
:)

c# browse for a image on web applications and display it

What would be the best way to create a C# Web Application that allows the user to browse for an image and then display it?
An equivalent of Picturebox in windows applications, sort of
Ideally the user should be able to click on Browse, choose the picture and see it in the browser itself
Thanks
There are all ready some image-browser for asp.net including source code.
Some of them
http://www.codeproject.com/Articles/17605/Thumbnail-Image-Viewer-Control-for-ASP-NET-2-0
http://www.codeproject.com/Articles/29846/A-simple-ASP-NET-AJAX-image-browser
For this, the user needs to choose an image which will be uploaded to the server, and then rendered in the HTML or recovered using AJAX. The problem is that you can't get rid of the send/receive, and it can get slow.
You can use a FileUpload or any other component that allows to upload files directly or via AJAX (look at AjaxFileUpload AjaxControlToolkit for this).
Then you need to add an <img> to your page, through a full postback or using any other means (like jQuery.Ajax).

Upload items from user computer to a server asp.net

I don't really know how to explain what I want to do.
I will try to explain what I am doing. I built a website in ASP.NET 4 (WebForms) and I want that my brother will be able to click on a button, choose a file from his computer and it will be uploaded to my server.
I have no idea how to do it. It sounds very hard to do and I am really stuck with this for a few days now.
I don't care if it will be with JavaScript, HTML or C#, I just really need it to work.
There's an ASP.NET control made just for that, the FileUpload control. Here's a handy example.
Note that it's notoriously difficult to style if you want to apply CSS and make it elegant, but there are more advanced ways around that. Also, this won't give your web application access to the client's local files or anything like that, it's just a standard file open dialog box for the user to select a file and upload it.
I also highly recommend doing a lot of input checking when accepting files. File type, file size, etc. are all important.
you have 2 options really.. use a traditional fileupload control (from the toolbox) or use the Ajax AsyncFileupload control.
either way it will allow your brother to upload a file from his computer to your server.

Uploading a file to Sharepoint Via webservices without a page refresh using Jquery

I am trying to create a wizard using jquery (fill in a dialog of info, press next, dialog changes but page does not refresh). During this process I would like to upload a file to a document library. I do not wish to reload the page. Is this possible? How would you go about doing this?
You can use uploadify plugin here, which uses a flash component to upload files and it provides events for almost every state of uploading, so you can fire your functions whenever you want for changing content showing alerts etc...
As redsquare says there are also other plugins, but i used this one in a project and it works pretty well.
Hope it helps,
Sinan.

Categories