C Sharp DEvelopment of Windows Forms Application - winforms

I'm developing a Windows Application in C sharp.using a Web Browser control to Login to the Https Site and Download the List of files. I'm able to login in to the Site and I'm able to Navigate to the Page where files are listed to be downloaded. When I try Downloading the file using the file URL and trying to Navigate using Web Browser Control a Pop - Up appears asking whether to Open or Save or cancel. How to handle this Pop up and I'm stuck here.
Any Answers are appreciated.
Thanks,
Vinay.

If all you are trying to do is download a file, you might be better off using webRequest.Create("Url") instead of the WebBrowser control. There are ways of handling authentication depending on the method the website uses.

It's best not to use the WebBrowser to download files (unless initiated by the user, who can click the save button). Instead, you can use a WebRequest to download the files from your application.
Since you said you have to log in to the website, I'm going to assume that it uses the popular method of using cookies (as opposed to HTTP Basic Auth). To get the cookies from the WebBrowser, you can use the Cookie property of the WebBrowser's Document property.

Related

Silverlight and XtraReports - opening generated PDF report in new tab in browser

I'm trying to send a PDF file from a WCF to silverlight client. PDF is generated by DevExpress XtraReports (in method XtraReport CreateReport(string reportTypeName, RootGenericReportParameterContainer reportInformation)).
Acually PDF is saved somewhere on clients computer after choosing save path in file save dialog - DevExpress takes care of everything - but I don't have a clue how to open the PDF in new tab in browser.
And here is another problem. Silverlight 4 has no access to local file system right? So information about local PDF location is useless. Maybe it would be better to save the PDF in WCF and send a link to it to the client - but how?
I would first question why you need to send the file to the Silverlight client. Get rid of that requirement and the solution becomes much simpler. Silverlight can provide a link that opens a new browser tab. That link would be handled by the web domain, processing it as an HttpHandler, generating the PDF file for the browser. Your PDF url doesn't have to reference a physical file, you can still generate it on request, handle querystring values, etc... Lots of different ways to do this.
Seems that the question isn't really about DevExpress or Silverlight - you're just looking to open a [document of some kind] in a new tab. Each browser natively handles things differently, and users can change tab handling to whatever they want. And (as you mentioned) once the user has downloaded the file, you no longer control it.
Your best bet (and the way I do it) is probably to have a link pointing to a handler/file using "target='_blank' " in the anchor tag on the webpage. From the server side, you would want to set the "Content-Disposition" header to "Inline" to indicate to the browser that the document should be displayed in place instead of downloaded ("Attachment").

SILVERLIGHT. How to download file like from web-site

I want download file from server. I know how to do this using WCF/RIA services. How can I do this like in web site. For example: I click button and It will appear standard dialog browser window to download file.
Use the Hyperlink control and link it to a server-side URL. This is what I've done in my app to avoid the whole generic save file prompt restrictions of the default SL sandbox.

store image in a folder form a list in silverlight

I want to store a image in to a folder which I have selected from a list in silverlight
In Silverlight you have only limited access to the file system for security reason.
So everything what you want to save would end up in IsolatedStorage...
Check out this Quickstart Video and let me know if it helps
http://www.silverlight.net/learn/quickstarts/isolatedstorage/
In Silverlight, You have limited access to the client file system. If you are running Out Of Browser application with elevated permission, you can access User folders (My documents in windows).
But you can try some workarounds like using JavaScript u can try to download file. For reference Download a picture OnClick

What is the best way to let users upload pictures to my WPF application

I have a WPF intranet app running in Trusted mode (local only).
I would like the users to be able to upload an image and attach it to an article on my newsletters section. I am having trouble deciding where these images will be stored.
Please provide me with your opinions.
At present I have a few ideas myself;
I could have an aspx page that runs parallel to this app, and run this inside a browser(I-frame). This page could then handle the upload and display of the image.
I could also, have the users copy directly to a network share.
It seems that there should be a more elegant sollution that I am not aware of.
Any ideas?
Don't force the solution towards ASPX just because you know how to do it there. It's unnatural to build a page, host browser to show that page etc, just so you could upload an image.
It's actually quite simpler to do it in a desktop client than on web page. You have a "Load File Dialog" - use that to get to the filepath the user wants to upload, and when you have that you can either:
copy it (inside your application) to your share,
or if you have a service - send it through some method call,
or you can even store it inside a database (recommended if the files are small)
There's really lots of options here... it depends if your client has connection to db, do you have service in between, etc...

How do I access the existing running windows forms application through url?

I have a windows forms application and which provides a way to search the database based on the provided value. Sometime I need to open the application through a simple html hyperlink with the search result while loading itself. There are two questions/doubts from here.
How to access the existing running windows forms application as url? If this is possible, how can I pass the argument?
If the application is not running, we have to start the application and search the value. This also has to be happened when I click the link.
Simply we can say like, if you open a website link from your outlook email, the link will be opening in existing opened default browser or it will start the new browser(if the browser is not already opened.) I want to achieve the same behavior.
Seems to be the below post is somewhat related to my queries, but this does not solve my problem.
Activate existing browser window with given URL from C# application (without triggering reload)
You can't do this. The default browser launches when you click on a link because it is set up in the registry as the default handler for hyperlinks.

Resources