473,480 Members | 1,995 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How can I 'read'/'write' a file with a url address?

Is there anything like this that will allow a url address instread of a
drive letter?:

Dim fw As StreamWriter
fw = New StreamWriter("D:\file.txt", True)
fw.WriteLine(ex)
fw.Close()

The reason I need to do this is it has to be done on the web server.
Thanks,
Trint

.Net programmer
tr********@hotmail.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #1
3 4667
* Trint Smith <tr********@hotmail.com> scripsit:
Is there anything like this that will allow a url address instread of a
drive letter?:

Dim fw As StreamWriter
fw = New StreamWriter("D:\file.txt", True)
fw.WriteLine(ex)
fw.Close()

The reason I need to do this is it has to be done on the web server.


Why not download the file, modify it, and then upload it again?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
Not really, as the URI will most likely specify an HTTP protocol, which only
allows uploading of data through a POST method, and hence there's no way to
write a file. There is a way to read from a URI, however, and I'm sure it's
along the same lines as what you're doing there.

--
HTH,
-- Tom Spink, Über Geek

Woe be the day VBC.EXE says, "OrElse what?"

Please respond to the newsgroup,
so all can benefit
"Trint Smith" <tr********@hotmail.com> wrote in message
news:eU**************@TK2MSFTNGP09.phx.gbl...
Is there anything like this that will allow a url address instread of a
drive letter?:

Dim fw As StreamWriter
fw = New StreamWriter("D:\file.txt", True)
fw.WriteLine(ex)
fw.Close()

The reason I need to do this is it has to be done on the web server.
Thanks,
Trint

Net programmer
tr********@hotmail.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #3
Trint,
You can use a StreamWriter to indirectly write to a URL.

The easiest way is to use WebClient.OpenWrite to get a writable Stream, that
you then pass to the StreamWriter class...

Something like (syntax checked only):

Imports System.Net
Imports System.IO

Dim url As String
Dim client As New WebClient()
Dim stream As Stream = client.OpenWrite(url)
Dim writer As New StreamWriter(stream)

A more complicated way is to use a WebRequest & WebResponse, however the
WebClient hides most of the details of the WebRequest & WebResponse classes.

Hope this helps
Jay

"Trint Smith" <tr********@hotmail.com> wrote in message
news:eU**************@TK2MSFTNGP09.phx.gbl...
Is there anything like this that will allow a url address instread of a
drive letter?:

Dim fw As StreamWriter
fw = New StreamWriter("D:\file.txt", True)
fw.WriteLine(ex)
fw.Close()

The reason I need to do this is it has to be done on the web server.
Thanks,
Trint

Net programmer
tr********@hotmail.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #4

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

Similar topics

0
1854
by: munif | last post by:
i wnat write a C++ program that would read from a CD and display information about files and folders in the given CD In simple words you would be performing a simple (ls -l) or (DIR /S) on the...
18
4850
by: jas | last post by:
Hi, I would like to start a new process and be able to read/write from/to it. I have tried things like... import subprocess as sp p = sp.Popen("cmd.exe", stdout=sp.PIPE)...
19
2045
by: Mark Richards | last post by:
I've been programming for many years, but have only recently taken a deep "C" dive (bad pun, i know) and need a lot of explanation from an expert. My questions center around those mysterious...
1
4288
by: Magix | last post by:
Hi, I have these string data: str_data1, str_data2, str_data3, which capture some value after a routine process A. Then I would like to write (append) these 3 string values into a text file each...
5
3146
by: Martin Svensson | last post by:
Hello! I need some help/recommendations on how to do the following. I have a program that writes an IP address two control numbers and a date to file, on one line. It's a basic text file and it...
8
23878
by: a | last post by:
I have a struct to write to a file struct _structA{ long x; int y; float z; } struct _structA A; //file open write(fd,A,sizeof(_structA)); //file close
2
2077
by: catronro | last post by:
I want to read an xml file and build a string based on that file. But when i try to implement it i get an Object Required error. Any help would be greatly appreciated. try { var xmlDoc = new...
0
846
by: tosenr | last post by:
I was trying to write an object into a xml file more like a database. I have this class called write to file. I am reading my var from a swing gui I created. Need help public String ...
1
22147
by: ashok0866 | last post by:
I had created a macro to read data from an excel sheet and write the values to a text file. I had used "ActiveSheet.Range("GB" & k).Value" command to read the values from the excel. The issue...
8
2143
by: andrew.jefferies | last post by:
Hi, I'm trying to write a simple log parsing program. I noticed that it isn't reading my log file to the end. My log is around 200,000 lines but it is stopping at line 26,428. I checked that...
0
7051
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
6915
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...
0
7097
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
6993
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...
1
4794
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4493
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3003
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...
0
2993
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1307
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.