473,387 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Could asp.net create files on client machine?

Does it have any ways that asp.net web application can create the file on
client computer or
get files from client computer?

Thanks.

May 30 '06 #1
7 20144
> Does it have any ways that asp.net web application can create the file on
client computer or
No
get files from client computer?


If the file is submitted via a file upload control yes, but the user will
have to click Browse and select the file to upload.
May 30 '06 #2
An ASP.NET application could get files from a client computer provided that
you have a FileUpload control (HtmlInputFile) on the page, which allows the
user to browse to a file and upload it.

Otherwise, built-in browser security restrictions disallow web applications
from accessing the local machine through the browser.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Grace" wrote:
Does it have any ways that asp.net web application can create the file on
client computer or
get files from client computer?

Thanks.

May 30 '06 #3
"Grace" <Gr***@discussions.microsoft.com> wrote
Does it have any ways that asp.net web application can create the file on
client computer or


As others have told you, you can't create files on the client computer
directly. The best you can do is create the file on the server and invite
the user to download it to the correct location. It depends what you're
trying to achieve. Perhaps if you give more details, someone can suggest a
more specific workaround.
May 30 '06 #4
First of all, an ASP.Net Web application can't do ANYTHING on the
client computer, since it only runs on the server. The best that it
could do, is to include some javascript on the page.

Javascript, in theory, could create a local file and upload a file to a
server, but these abilities are normally disabled by the brower as a
security measure.

May 30 '06 #5
The following WebForm2.aspx is to create a text file on client machine.

If I want to let WebForm2.aspx execute, client IE's setting must be set LOW
security,
and IE will show a dialog to ask users if it is allowed to run ActiveX
Controller.

But IE Browser's default security setting isn't low security.
So, if users execute this web page, it will have a scripting error
(Automation couldn't produce the object.)

Is there any ways that can solve this situation
(When client's IE security setting isn't low security,
and we don't want to let users see the scripting error) ?
--------------------
WebForm2.aspx:
--------------------
<html>
<head>
<title>WebForm2</title>
</head>
<script language="javascript">
var fso = new ActiveXObject("Scripting.FileSystemObject");
var a = fso.CreateTextFile("c:\\testfile.txt", true);
a.WriteLine("This is a test.");
a.Close();
</script>
<body>
</body>
</html>

"ja**********@gmail.com" wrote:
First of all, an ASP.Net Web application can't do ANYTHING on the
client computer, since it only runs on the server. The best that it
could do, is to include some javascript on the page.

Javascript, in theory, could create a local file and upload a file to a
server, but these abilities are normally disabled by the brower as a
security measure.

Jun 1 '06 #6
If it is literally just a javascript error, then try/catch may mask it.
HOWEVER the concept is still really, really dodgy; put simply: you are not
allowed to do this. A browser being able to read/write files silently on the
HDD is such a huge, gaping security hole that I am very, very glad that
every browser (and some AV sw) worth using doesn't allow it. Maybe if you
could convince the user to install certain infamous DRM sofftware you might
be able to find a back-door way to do it, but if I saw this code in a web
page I would assume you were a hacker and simply block all access to the
site. Not great if you are actually trying to sell products or services.

Marc
Jun 1 '06 #7
Thanks.
I will use javascript's try/catch to tell users what to do.
"Marc Gravell" wrote:
If it is literally just a javascript error, then try/catch may mask it.
HOWEVER the concept is still really, really dodgy; put simply: you are not
allowed to do this. A browser being able to read/write files silently on the
HDD is such a huge, gaping security hole that I am very, very glad that
every browser (and some AV sw) worth using doesn't allow it. Maybe if you
could convince the user to install certain infamous DRM sofftware you might
be able to find a back-door way to do it, but if I saw this code in a web
page I would assume you were a hacker and simply block all access to the
site. Not great if you are actually trying to sell products or services.

Marc

Jun 2 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Prashanth Uppunda | last post by:
Hello, Does anybody have an idea on how to instantiate a DCOM server residing in another machine using C#? Thanks Prashanth
3
by: Wade | last post by:
I would like to install the .Net 1.1 framework on a Web Server running W2K to be able to run ASP.NET files, but I'm not sure where to find the files I need for the .Net framework. I have ".NET...
0
by: Data | last post by:
In my project I want to execute some commands on the remote machine. I am using .Net Remoting to achieve this. My server which is an exe is copied on the remote machine and it receives command from...
5
by: Data | last post by:
In my project I want to execute some commands on the remote machine. I am using .Net Remoting to achieve this. My server which is an exe is copied on the remote machine and it receives command from...
4
by: Khalique | last post by:
I have built a web service whose purpose is to copy files from a secure place to client machine and vice versa. The problem I am having is perhaps related to permissions and access rights. For...
1
by: drk.kumar | last post by:
I have an implementation issue with WMI scripts to check the user machine processor. The implementation is working fine in the local machine (Windows XP operating system). It is throwing script...
3
by: Ted | last post by:
In WSAT, I get the following error when trying to set up my provider: Could not establish a connection to the database. If you have not yet created the SQL Server database, exit the Web Site...
8
by: Irfan | last post by:
hi, I created a setup file using the Publish Wizard in Visual Studio 2005 and installed the software in the client machine. Now I want to update some of the installed files in the client...
3
by: Lance Wynn | last post by:
Hello, I am receiving this error when trying to instantiate a webservice component. I have 2 development machines, both are XP sp2 with VS 2008 installed. On one machine, the code works fine. On...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.