By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,454 Members | 3,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,454 IT Pros & Developers. It's quick & easy.

Web Server Read/Write

P: n/a
Hello,

I am trying to Read and Write to a text file on a web server using Microsoft Visual Basic 2005 Express Edition.

So far I have managed to complete my testing with a local text file using the StreamReader Class. Is it possible to use this class when trying to read and write to a text file located on a server? If so, could you please provide some examples?

I have setup a free web host with www.ifastnet.com and have some connection settings, mostly for FTP and mySQL.

If this is not a feasible option, could anyone help me with a web connection to a mySQL database to send data from client?

I would appreciate any help anyone can provide.

Thanks in advance.

Ross
Nov 19 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Nov 18, 7:27 pm, "Ross" <ross-coo...@hotmail.comwrote:
Hello,

I am trying to Read and Write to a text file on a web server using Microsoft Visual Basic 2005 Express Edition.

So far I have managed to complete my testing with a local text file using the StreamReader Class. Is it possible to use this class when trying to read and write to a text file located on a server? If so, could you please provide some examples?

I have setup a free web host withwww.ifastnet.comand have some connection settings, mostly for FTP and mySQL.

If this is not a feasible option, could anyone help me with a web connection to a mySQL database to send data from client?

I would appreciate any help anyone can provide.

Thanks in advance.

Ross
What do you mean "on a server"? Is this a separate server, or the host
web server, or a mapped network drive, or something else?

Thanks,

Seth Rowe
Nov 19 '07 #2

P: n/a
Sure assuming that your code runs on the server (i.e. you write on your own workstation but because you runs server side code and so it will work on the web server side ; a common error is rather to think it writes client side when this is just because in a testing environment the client and the server are the same machine).

IMHO it's always best to tell us what you tried and what doesn't work rather than asking for samples.

The code is really just the same. Most problems are :
- permission issue
- writing in the "default" directory which is meaningless for a web application. Make sure to use an absolute path name (Server.MapPath could help).

For example #1 is not related at all with the actual code so a sample wouldn't help anyway. So what if you try the class you tested on your local web server ?

---
Patrice

"Ross" <ro*********@hotmail.coma écrit dans le message de news: 9E**********************************@microsoft.com...
Hello,

I am trying to Read and Write to a text file on a web server using Microsoft Visual Basic 2005 Express Edition.

So far I have managed to complete my testing with a local text file using the StreamReader Class. Is it possible to use this class when trying to read and write to a text file located on a server? If so, could you please provide some examples?

I have setup a free web host with www.ifastnet.com and have some connection settings, mostly for FTP and mySQL.

If this is not a feasible option, could anyone help me with a web connection to a mySQL database to send data from client?

I would appreciate any help anyone can provide.

Thanks in advance.

Ross
Nov 19 '07 #3

P: n/a
Ah you meant from a Windows application ? (I missed the "Visual Basic" instead of "Visual Web Developer")

It doesn't work this way as you generally don't have direct access to the web server file system.

You could post your file data using System.Net.WebClient.Uploadfile to upload the content of the text file to the web server. Server side you have a web page that receives this file (through the request.Files) and does whatever you want using this content.

You could also use web services so that the web site sends datasets to your client application thjat can then work on them and resubmit changes to the web server (is this a client side application that should be able to work on MySQL data handled by a web site ???)...

--
Patrice
"Patrice" <http://www.chez.com/scribe/a écrit dans le message de news: Op**************@TK2MSFTNGP05.phx.gbl...
Sure assuming that your code runs on the server (i.e. you write on your own workstation but because you runs server side code and so it will work on the web server side ; a common error is rather to think it writes client side when this is just because in a testing environment the client and the server are the same machine).

IMHO it's always best to tell us what you tried and what doesn't work rather than asking for samples.

The code is really just the same. Most problems are :
- permission issue
- writing in the "default" directory which is meaningless for a web application. Make sure to use an absolute path name (Server.MapPath could help).

For example #1 is not related at all with the actual code so a sample wouldn't help anyway. So what if you try the class you tested on your local web server ?

---
Patrice

"Ross" <ro*********@hotmail.coma écrit dans le message de news: 9E**********************************@microsoft.com...
Hello,

I am trying to Read and Write to a text file on a web server using Microsoft Visual Basic 2005 Express Edition.

So far I have managed to complete my testing with a local text file using the StreamReader Class. Is it possible to use this class when trying to read and write to a text file located on a server? If so, could you please provide some examples?

I have setup a free web host with www.ifastnet.com and have some connection settings, mostly for FTP and mySQL.

If this is not a feasible option, could anyone help me with a web connection to a mySQL database to send data from client?

I would appreciate any help anyone can provide.

Thanks in advance.

Ross
Nov 19 '07 #4

P: n/a
Hi, and thanks for the quick responses guys. Much appreciated.

My apologies, I think I may not have explained what I was trying to accomplish well enough in the first instance. Having been completely dumbfounded prior to posting, didn't help my explanation.

Basically, I have a Windows Application that prompts a user to input data. I would like this data to be written(uploaded) to either a text file or mySQL database on a remote server (current host: www.ifastnet.com).
This would enable a separate part of the program (distributed to other users) to download everyone's datasets (previously uploaded data) and present it accordingly.

The problem that I think I face is that, I am not using a hosted Microsoft SQL Server anywhere (as it costs, and would like to try alternative methods before applying cash to my little project) and I'm trying to get round this by alternative means.

It would be nice to practice freely using either a text file or mySQL using a free webhost, but I am unsure as to how to go about this. But I suppose that I may have to turn to a hosted MSSQL Server to complete the project.

I hope this added explanation helps.

Thanks for you comments regarding the WebClient.Uploadfile, I'll give it a try and see how I get on. But I would appreciate any further insight you might have.

Thanks guys,

Ross

"Patrice" <http://www.chez.com/scribe/wrote in message news:Ot***************@TK2MSFTNGP03.phx.gbl...
Ah you meant from a Windows application ? (I missed the "Visual Basic" instead of "Visual Web Developer")

It doesn't work this way as you generally don't have direct access to the web server file system.

You could post your file data using System.Net.WebClient.Uploadfile to upload the content of the text file to the web server. Server side you have a web page that receives this file (through the request.Files) and does whatever you want using this content.

You could also use web services so that the web site sends datasets to your client application thjat can then work on them and resubmit changes to the web server (is this a client side application that should be able to work on MySQL data handled by a web site ???)...

--
Patrice
"Patrice" <http://www.chez.com/scribe/a écrit dans le message de news: Op**************@TK2MSFTNGP05.phx.gbl...
Sure assuming that your code runs on the server (i.e. you write on your own workstation but because you runs server side code and so it will work on the web server side ; a common error is rather to think it writes client side when this is just because in a testing environment the client and the server are the same machine).

IMHO it's always best to tell us what you tried and what doesn't work rather than asking for samples.

The code is really just the same. Most problems are :
- permission issue
- writing in the "default" directory which is meaningless for a web application. Make sure to use an absolute path name (Server.MapPath could help).

For example #1 is not related at all with the actual code so a sample wouldn't help anyway. So what if you try the class you tested on your local web server ?

---
Patrice

"Ross" <ro*********@hotmail.coma écrit dans le message de news: 9E**********************************@microsoft.com...
Hello,

I am trying to Read and Write to a text file on a web server using Microsoft Visual Basic 2005 Express Edition.

So far I have managed to complete my testing with a local text file using the StreamReader Class. Is it possible to use this class when trying to read and write to a text file located on a server? If so, could you please provide some examples?

I have setup a free web host with www.ifastnet.com and have some connection settings, mostly for FTP and mySQL.

If this is not a feasible option, could anyone help me with a web connection to a mySQL database to send data from client?

I would appreciate any help anyone can provide.

Thanks in advance.

Ross
Nov 19 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.