473,803 Members | 3,899 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

To create a text file in local macine from website..

11 New Member
( all in my websites) I am opening a database (stored in ftp -- ms access database) ..
after retrieving i want to write to a file in local machine... (something .. c:\test.txt)

its work fine while i am running in local host.. but in net .. its showing error...

i want to know if i want to create a file.. from website.. whether i have to provide any permission.. (security concern)

please answer
regards
ela
.

MY coding is....
Expand|Select|Wrap|Line Numbers
  1. <%
  2.  
  3.          Set fs = CreateObject("Scripting.FileSystemObject") 
  4.          Set wfile = fs.CreateTextFile("c:\myfile.txt", True) 
  5.  
  6.  ------------this database in ftp
  7.  
  8.      call opendatabase()
  9.            Set rsftp= con.Execute("select * from sendsms")
  10.            While not rsftp.Eof 
  11.               msg=rsftp.fields("col1")
  12.               sender=rsftp.fields("col2")
  13.  
  14.            'wfile.Write (msg)
  15.            'wfile.Write (sender)
  16.                   rsftp.movenext
  17.            wend
  18.  
  19.    Conloc.Close()
  20.    call closedatabase() 
  21.  
  22.  
  23. %>
Oct 22 '07 #1
2 1868
JamieHowarth0
533 Recognized Expert Contributor
Hi Elavarsi,

You need to create a text file that will be held in session and then use a download stream to stream the text file to the browser, as your current code is set to try and save the text file to your web server's C: drive which will be completely blocked as standard.

This article explains how to use the following code to force the web browser to download a file:

Expand|Select|Wrap|Line Numbers
  1. Response.AddHeader("content-disposition:attachment;filename=temp.txt")
  2.  
The browser will recognise it as an attachment and prompt the user to save the file to their hard disk. For security purposes there is no way of automatically saving a file using ASP to a user's hard disk, otherwise very malicious individuals could use it to automatically download viruses to your PC.

Best regards,

medicineworker
Oct 22 '07 #2
clain
79 New Member
in no way you can save a text file from wesite....

if that was possible then .... ooops what will be the securty for your pc?
Oct 25 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
5591
by: Mark | last post by:
How can I programmatically discover the IP address of the computer on which my assembly is executing? Thanks.
0
1114
by: lewi | last post by:
I am try to get in ASP.NET developement and I got IIS 5.0 and VS.NET 2002 on Windows 2000 Server... I created a new website(index.asp - just text without HTML/ASP tags - works in IE) in IIS and now I try to create the ASP.NET C# app and I get a website share error... Some data... 1) The new IIS website is called "products" @ http://www.myaddress.com/index.asp which resolves to IP 127.0.0.1 and the
3
14966
by: Amjad | last post by:
Hi, I just wrote a test Windows Service that creates a text file on startup (please see my code below). The file is never created. Protected Overrides Sub OnStart(ByVal args() As String) Dim swLog As StreamWriter = File.CreateText("C:\myLog.txt") swLog.WriteLine("My Windows Service has just started.") swLog.Close() : swLog.Flush() End Sub
3
2414
by: DBLWizard | last post by:
Howdy All, Is it possible to have Visual Studio 2005 create a project form an existing hosted website? In other words I want to be able connect via ftp to my website structure and have it pull down all the files and create a local project from it? I know things like DreamWeaver will do this ... and I have been poking around VS 2005 and haven't seen anything that jumps out at me.
16
3898
by: Mich | last post by:
Hi, i'm building an web application for anonymous users. They can take a look in the website, nothing more. In order to perform other actions, the anonymous user must be logged. So i create an aspx page with the CreateUserWizard control. The user can fill his username, password etc .... My problem is: when an user fills everything and clicks on button "create an account", nothing happens (no error, but no user account created). I...
5
6574
by: =?Utf-8?B?TGVvbg==?= | last post by:
Hi Everybody. I am running VS 2005 with Service Pack on Windows 2003 server. All I was trying to do is to create a new website. I am getting an error message: Unable to create the Web 'http://MySite'. Could not find a Webserver at 'MySite'. Please check to make sure that the web server is valid and your proxy settings are set correctly. If you are sure that everything is correct, the Web server may be temporarily out of service. Does...
4
6917
by: Vlad | last post by:
I am having problems using the file.create method within a function that is called when looping through an array of filepaths. If I call my function with a hardcoded file path --C:\Temp.txt the function creates the file as expected. When I loop through my array I get the error - "ArgumentException was unhandled - Illegal characters in path" The value "C:\Temp.txt" is the first value in the array - as it works
2
2418
by: John_Doe | last post by:
Can anyone clarify what the difference between these two choices is when developing website? I have IIS installed too, so I can pick this too if there is a reason. From the point of view of sharing the code with other developers and keeping source in VSS File System seems to be more flexible choice. However, my current understanding is that when you keep it in the File System and start it from Visual Studio it runs on Web Server built...
0
9564
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10546
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10292
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10068
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9121
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5498
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5627
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.