How to read file form local file system(client side) in asp.net , is there any activeX require to do this or it can be done with out it
It cannot be done without extra help like an ActiveX, but I'm not aware of any ready-made solutions. Why do you want to read a local file? Most users will not like this approach...
What are you really trying to do ?? Isn't there another way (e.g. user uploading the file to your ASP.NET site) to achieve the result you want??
Marc
you can use Javascript and this can be done by using FileSystemObject object
check the following link:
File Handling at Client Side using Javascript
Note:
This object is part of Microsoft' Scripting Engine, and thus this column is applicable only to Microsoft Windows operating systems.
As Marc Said, ASP.net can't do it.
There are a few options
Provide a file upload mechanism (most common, easiest)
Use ActiveX
Use Silverlight, at least with silverlight you can write in managed code and access the client(instructions for file open and file save)
Related
When I am actually interacting with IE through a .aspx file. I can refer to the defautl xslt as res://msxml.dll/defaultss.xsl.
Dim objDefaultXSL As New System.Xml.XmlDocument
objDefaultXSL.load("res://msxml.dll/defaultss.xsl")
But if I am not using IE which url should i use to to accomplish the same?
Thanks
When i am actually interacting with IE through a .aspx file
I have no idea what you mean with this. ASPX is used server-side to dynamcially create HTML or other pages and serve them with a web server to the client side. The client side can be Internet Explorer, but the ASPX code does not "interact" with the client.
but if I am not using IE which url should i use to to accomplish the same? Thanks
res://msxml.dll/defaultss.xsl is a location in a resource inside a DLL, in this case msxml.dll. This is a Microsoft-specific DLL, used when people in Internet Explorer use XML or XSLT technologies.
When you are not targeting IE, this DLL will not be loaded and so you cannot access that file. But if, for some reason, you want that resource, simply load and save it to disk once and reuse it in your other code. Whether this makes any sense, I doubt it, because that file is specifically meant for IE.
Informative
I'm working on a project that loads a binary file from the disk. This file has a specific structure to store data and I need to protect this file from being loaded if the data was generated/tampered by third parties.
Resume
I have a file that I must check if the "creator" is me before loading.
Project Specification
The application that loads the file is written in C++.
The application that generates the file is written in C#.
Question
What are my options to accomplish this?
What libraries/algorithms to use?
Can you provide me some steps or guides?
Notes
I have Crypto++ linked to the C++ project if it helps.
What you are looking for is a signing/certifying system wirth asymetric keys. The functionality is built in .Net. A Quick google search shows this example which looks legit.
Keep in mind though, that if you don't have the full control of the certification process (if your application is on a client's computer), someone might decompile the code to bypass the check.
quickly like that i would take a look at LZMA SDK since the SDK support c++ and C# and just compress/encrypt the file
maybe there is a better solution, but this would be my first try
I am looking to create a desktop application in C# which :
Allows the user to select a file / multiple files / folder containing files from his computer.
Upload the files selected to a PHP script (which is already equipped to handle file uploads using the $_FILES array.)
I'm a PHP developer and have never coded a single line of .NET before. So, you can assume I have no experience with .NET whatsoever.
I have looked this up online and all I seem to come up with are ASP.NET server side upload controls which i do not want. I'm looking for a client side solution. Also, will i have to make any changes in my PHP script ? The script already handles uploads from an HTML multipart form.
If anyone can help me point in the right direction of where to look, what C# controls are available which can help me create the application I need, I would really appreciate it.
The first, and simplest, way to go about this is to use any of the WebClient's UploadFile methods.
Here's some info an an example;
http://msdn.microsoft.com/en-us/library/36s52zhs.aspx
I have a feeling that this will not be enough for you, since you want to upload multiple files in a single request. The WebClient class can be used to manually build a http multipart request, which is probably your best bet.
It's a bit much to explain how to achieve this here on SO, but there are good guides out there.
Here are a couple of very to-the-point articles
http://www.codeproject.com/KB/cs/uploadfileex.aspx
http://www.codeproject.com/KB/IP/multipart_request_C_.aspx
And if you're interested in the details, or better OO design, here's an alternative (a bit harder to follow if you're not experienced with C#)
http://ferozedaud.blogspot.com/2010/03/multipart-form-upload-helper.html
I think both articles should give you enough info to get started.
We all know that it is possible to "open" a Word document (or file from any arbitrary application) by clicking on a website link and then clicking the Open button.
I also know that, if I want to upload an application document to a web server, I must first save the document to my computer, and then go to an upload page, click a file/open button, find my saved file and upload it.
But is it possible to save a document to a website location or Url, effectively skipping the first save step and uploading the file to the web server through the Save dialog of the application, directly?
How would this be done in ASP.NET MVC?
It really depends on how complex you want to make it. This is pretty much what "web folders" offered (via WebDAV), but in general it creates more problems than it will ever fix. I don't recommend this approach.
Your best bet to make this simple is a dedicated client app - perhaps (although this is a dubious example) how Office talks to sharepoint. In a simpler example, you could create a silverlight out-of-browser application that saved via a web-service to a site using WCF or similar.
I think there is some creedence in what #Marc says. Personally I'd probably map a drive to the web site in question, if that's possible, and have a folder to upload to.
Then I'd have .Net check changes to the folder and take those files and import them into the repository, whatever that may be.
It's still an imperfect solution and I'm not sure there is a correct solution as yet.
I guess you could always write, and I can't believe I'm writing this, macros to save to the ftp location.
I'd guess you have a few choices, in no particular order:
Web service that the application can reference and upload through.
REST service (WCF or otherwise) that the application can POST to.
HttpHandler or MVC controller action that the application can POST to.
WebDAV directly to the server.
Number 3 sounds like it's closest to what you were looking for ("How would this be done in ASP.NET MVC?"). Scott Hanselman has a good article on handling file uploads in MVC on his blog.
When you implement the client, there's a little bit of a trick to that, too, since you can't just POST like usual; you have to post in multipart/form-data format. I posted a blog entry with some sample code on how to do that.
I know i can use AJAX and SILVERLIGHT with my ASP.NET web page. But what do you think about using flash with asp.net? Can this be done? How can this be done? Would you recommend me using flash at all with ASP.NET? I will NOT be using WEB SERVICES, just a plain ASP.NET website.
Thanks in advance!
EDIT: What about performance issues???
I have used Flash in ASP.NET websites plenty.
Software should always boil down to the best tool for the job, if Flash is the way you need to go for your RIA, then so be it.
Remember, ASP.NET is nothing "new/different" ultimately, it is just a fancy HTML generator.
Therefore, to use flash, you simply use the plain old HTML OBJECT and EMBED tags to place the Flash on the page.
The benefit of using things like ASP.NET (or any other framework) is that you can encapsulate the EMBED logic to use things like swfObject.
flash is client side, what you use server side has very little impact on it.
Given Flash's high market penetration (98%+), I think Flash is a great way to go regardless of the underlying platform.
But, as with everything, it depends on what you want to do. If you want to deliver a rich user interface via Flash, you should consider using Flex.
There are several tools to help integrate a Flash/Flex application with ASP.NET. One of these that I recommend is WebORB.
It certainly can be done! We've done entire flash-based websites in the past that rely on data generated by a CMS and read from flash via XML. There are of course lots of gotchas (loading html text, multilingual characters), but once you've done it a few times you'll get the hang of it.
Flex is probably a better option.