.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

without asking location save file

Posted By: shahin     Posted Date: August 04, 2011    Points:5   Category :ASP.Net

when member login successfully,
i want to store xxx.txt file in D drive i.e D:\txt\xxx.txt
[without asking location]
in vb.net for website.

is it possible ?
how ?

Author: Sunil Yadav       [Moderator]      
Posted Date: August 04, 2011     Points: 20   

Yes, it is possible. You can create a file without a prompt. In case of shared webhosting, you need to check whether you have permission on D drive or not?

To create a text file, look at the code below.

string sPath = "D:\txt\xxx.txt";
if (!File.Exists(System.Web.HttpContext.Current.Server.MapPath(sPath)))

StreamWriter objStreamWriter = File.AppendText(System.Web.HttpContext.Current.Server.MapPath(sPath));
objStreamWriter.WriteLine("\r\n This is test : ");

Hope this helps.

Author: shahin             
Posted Date: August 05, 2011     Points: 20   


i want to store file in member's machine D drive , not on server.
who is visit to my site i want to create D:\txt\xxx.txt to their machine
i.e want to access d drive .

i think this code is for webserver's D drive ....

Author: Sunil Yadav       [Moderator]      
Posted Date: August 05, 2011     Points: 20   

Since security is a major concern in this case, creating a file at a client machine is not possible.
Prompt for file save would be the better solution here.

Author: shahin             
Posted Date: August 12, 2011     Points: 20   

ok thanks for reply...

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend