File is not accessible after File.Create()

When I use File.Create(filename) method, file is created but it is inaccessible until application closes. That means I cannot add any text lines to this file which is my intention. Is there some method to end File.Create like StreamReader.Close() or something ?
0
ivasic
11/6/2003 6:19:45 PM
asp.net.web-forms 93655 articles. 6 followers. Follow

6 Replies
981 Views

Similar Articles

[PageSpeed] 50
Get it on Google Play
Get it on Apple App Store

Did you use file.open method to write to that file.

Make sure to check the folder permissions. You should give ASPNET Machine Account write permissions to that folder. If you do not have one listed, Add user ASPNET and give him appropriate permissions. Hope this will help.
0
vintech
11/6/2003 7:05:54 PM
This should work, although FileStream don't let you directly write text line into file (you need to specify byte array)

Is it in web application? If, the File.Create() will not work unless you specify the impersonation or change directory security setting
Hope this helps
Yugang
_________
This posting is provided "AS IS" with no warranties, and confers no rights.
0
yugangw
11/6/2003 7:14:14 PM
No there is no problem with security in that directory. ASP.NET is regularly configured but same thing happens in WindowsApplication. Although I didn't use File.Open method to write to file. I'll try this. 

But, when I try to write to existing file - I don't get error....
Also, after File.Create() accessing that file from e.g. windows explorer is not possible until application closes...
0
ivasic
11/7/2003 12:01:33 PM
If you call File.Create() first, this file can't be opened correctly in windows explorer before you call "Close".

Is it possible for you to post your code of windows application? I can't repro your problem
Thanks
Yugang
0
yugangw
11/7/2003 9:10:32 PM
"this file can't be opened correctly in windows explorer before you call "Close"."

this is the whole problem ! How do I call "Close" ???
Anyway my code is not very helpfull because it's only one line :

File.Create("d:\preferences.txt");

After this until application exits, file is not accesible
0
ivasic
11/8/2003 2:14:04 PM

Hi.... you surely have figured this out by now.... but for others developers with the same problem....

 

File.Create("d:\preferences.txt").close();
 
Best wishes for you all. 

 


Regards

Allan Pedersen
Denmark
0
albani
6/14/2007 3:01:11 PM
Reply:

Similar Artilces:

to file:// or not to file://
(Firefox 1.5.0.6) I'm having trouble with HTML Anchors (links) using the file: protocol. The URL I'm trying to get at looks something like this file://///Host.Domain/Share/Dir1/Dir2/File.Ext If I click on the link, /nothing/ happens but, if I "Copy Link Location" and paste exactly the same thing into the "address bar" in FireFox, FireFox is perfectly happy to show me the file. Why the difference? Am I tripping over some security restriction here? Any suggestions? TIA, Phill W. Phill W. wrote: > (Firefox 1.5.0.6) > I'm ...

How to Create .mdb file from Excel file using C#.net
Hi all I want to create .mdb file that i have created excel feel from MS jet Database... through code behind Help me in this..  Regards RaviPlease click "mark as answer" if this post helped you. How to create an mdb file programmtically:http://support.microsoft.com/kb/317881How to import Excel data into it: http://www.mikesdotnetting.com/Article.aspx?ArticleID=79 Regards Mike [MVP - ASP/ASP.NET]My site...

How to insert audio files and play audio files in a web form
Hi, 1) Could you please post a sample code which shows how to save an audio file and play an audio file from server? 2) Which of the following way is better for performance?         a) Save the audio file to a folder in the server and save the name of the file in database.         b) Save the audio file directly to database in binary format. Requirement is that Many people will be accessing the site and the same file at the same time. If anybody has any code for saving and playing audio file,...

Creating .NET Code to read a .his file (like a .txt file)
Hello all! I'd like to read data from a temperature control program that posts data to a .his file.  Sample entries are pasted below: "","",RT3-RH%,RT3-HUSP,RT3-ZNT,RT3-RAT1,12/4/06 4:10:52 PM,13.12,45.00,64.44,65.882,12/4/06 4:15:52 PM,13.13,45.00,64.44,65.813,12/4/06 4:20:52 PM,13.08,45.00,64.44,65.754,12/4/06 4:25:52 PM,13.13,45.00,64.44,65.695,12/4/06 4:30:52 PM,13.11,45.00,64.44,65.696,12/4/06 4:35:52 PM,13.09,45.00,64.44,65.637,12/4/06 4:40:52 PM,13.27,45.00,64.44,65.568,12/4/06 4:45:52 PM,13.32,45.00,64.44,65.75  I'd like to skip the first line...

Create a text file from a web form
Is there an open-source tool that can be used to create a simple web form that prompts for some basic information and then create a text file on the users workstation. What I want to do is to create a standard e-mail signature file for my users. To do that I was thinking of prompting them for their information and then formatting that information into a html file that I would then save on their workstations for use. Ideally I'd also like to save a graphic image as well along with the html file. I need to do something that does not require any code to be installed on the...

I create the file like this System.IO.File.Create("pallingtest1.txt") but how do I tell it where to save the file?
can anyone help? Why don't you specify the fully qualified path where you want to write the file rather than try and figure out where its going to write it? Jeev~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~If you get the answer to your question, please mark it as the answer.  From the MSDN docs: <i>The path parameter is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see GetCurrentDirectory.</i>http://msdn2.microsoft.com/en-us...

how to create web service that create xml files availible for web application
Hi epxerts im new in web service. I have a web link which contains nothing when you visit that web link. But when you view the source it will show the xml source in it. I want to create that xml file through web service and make these xml files availible for my application. Best RegardsShaukat Waqar...

Connection string with web.config file (MS Access database file)
Hi,I have a ms access file int he App_Data ditrectory of my solution explorer the file is of course in the inetpub/wwwroot/form directory (a solution i created to test this...Anyways I need help creating an access connection string.  I have one currently working for sqlserver 2005 in that file...So I want to add a new one and have lots of strings in one file to chose from...I can't find any good examples online and need a little help constructing the connection string.Thanks,Frank  Seek no more.  Bookmark this page: www.connectionstrings.com Regards Mike [MVP - ASP/ASP....

WEB FORMS and datasetS (do I have to repeat the file definition in every web form?)
I am working on vb.net.I have a project with 35 web forms and an access file with 18 tables.Until now I have defined the oledbadapters in every form by dragging the tables from the server explorer tool box.This is not a good idea because every time that I make a change on the database design I have to drag the new definition on 35 web forms and I have to create the datasets again. This is boring and time consuming!The question is:WHAT CAN I DO TO HAVE THE FILE DEFINITION ONLY IN ONE PLACE AND THAT EVERY WEB FORM WOULD TAKE THE DATA ADAPTERS AND DATASETS FROM THERE? how about if you write a...

Accessing media files on mobile web form
Hi all,I am new to mobile application development and i need to work on accessing media files in mobile web forms. I do not know how. please anyone can give me information on this.thankyou...

how to read a .txt file from .net (web form)
hi, how to read a .txt file line by line and place the contents in a .xls file. ex: if sample.txt file is... Name: abc Company: xyz info ltd. i want abc and xyz info ltd to be cut and saved in .xls file. i already have a .xls template with name and company fields. send solution.......

Reading Excel Files from a .Net Web Form
Hi, This might be a dumb question, but ... When reading an Excel file from a .Net Web Form, is it necessary to have Microsoft Excel actually installed on the client machine running the web form? Also, do the Excel files being read need to be saved as "values only" or can the values be extracted from a spreadsheet where the cells contain formulas? Thanks. -Wayne Hi, For the 1st part, Office is not necessary to be installed. But Download the Office XP PIAs and use them to develop Office XP solutions with Visual Studio .NET. For 2nd Part I think you need to use Values.Regar...

How do you access an INI file from a web form application?
---== Posted via the PFCGuide Web Newsreader ==--- http://www.pfcguide.com/_newsgroups/group_list.asp Same way you always did, but you might want to consider switching over to GetConfigSettings instead. On 14 Mar 2008 03:46:40 -0800, "Dave Harbud" <david@chaseits.co.uk> wrote: > >---== Posted via the PFCGuide Web Newsreader ==--- >http://www.pfcguide.com/_newsgroups/group_list.asp The same, except that you need to keep in mind that you're accessing the INI in the virtual file system that it created, so GetProfileString ("c:\MyINIFol...

Importing text file (possibly a excel file) via a web-form to a database.
Hey there - I'm sort of new to this and have a question - which in itself is probably easy, I'm just having trouble finding it. I need to import a text file - possibly later an excel file - into a SQL database via a web-form upload function. Can anyone point me in the right direction? A tutorial page that you know of or sample code, possibly? Any help would be appreciated. Thanks Hi, Take a look @ : - Reading a Delimited File Using ASP.Net and VB.Net - HTHK B ShajudeenAreYaar.comDubai, United Arab Emirates. That was perfect - thank you!...

Web resources about - File is not accessible after File.Create() - asp.net.web-forms

File:Handicapped Accessible sign.svg - Wikipedia, the free encyclopedia
450 mm by 450 mm (18 in by 18 in) Handicapped Accessible sign, made to the specifications of the 2004 edition of Standard Highway Signs (sign ...

Facebook Updates Graph API To Make Data More Accessible To Developers
Developers were pleased with Thursday’s improvements to Facebook’s Graph API , which allows them to access data in the social graph quicker and ...

Making Facebook Accessible for Everyone
von Kathy H. Chan, Montag, 6. April 2009 um 16:02 Carl Augusto is the President and CEO of the American Foundation for the Blind, a U.S.-based ...

Accessible Podcast (@accessibleshow) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Accessible othello on the App Store on iTunes
Get Accessible othello on the App Store. See screenshots and ratings, and read customer reviews.

Keep Abortion Safe, Legal & Accessible
Explore World Can't Wait's photos on Flickr. World Can't Wait has uploaded 2025 photos to Flickr.

Boehner, House GOP Outline Plan to Make Health Care More Affordable & Accessible for All Americans ...
House Republican Leader John Boehner (R-OH) today issued the following statement after Members of the House GOP Health Care Reform Solutions ...

Coles to make online shopping site more accessible following disability discrimination case
Supermarket giant Coles has agreed to improve its online shopping website so that it can be more easily accessed by blind people, after being ...

It doesn't add up: there's no proof maths can't be accessible for everyone
Does mathematics have an image problem? For 20 years students have been drifting away from studying higher-level mathematics at school and enrolments ...

Vodafone's customer database accessible over the internet
SITTING in a western Sydney business with a laptop and someone who knew a login for Vodafone's customer database, I handed over my mobile number ...

Resources last updated: 1/3/2016 1:59:20 AM