Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8545731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:51:36+00:00 2026-06-11T12:51:36+00:00

I am unable to open the file just after creating the file in c#

  • 0

I am unable to open the file just after creating the file in c# webservice code .
The directory is not present initially. So the program creates the directory and the file. Then tries to open the file to write a line. But it fails to open the file. The error is the file is open in another process.

I tried to open the file from windows explorer. the file opens but error message is still coming.
I tried to delete the folder C:\Test, it says file is open is in WebDev.WebDevServer40.exe

Any help please.

[WebMethod]
    public string saveFileUploaderName(string name)
    {
        string path = "c:\\Test";
        string filename = "Test.txt";
        string completeFileName = Path.Combine(path,filename);
        if(!File.Exists(completeFileName))
        {
            Directory.CreateDirectory(path);
            File.Create(completeFileName);
        }
        StreamWriter writer = File.AppendText(completeFileName);
        writer.WriteLine(name);
        writer.Flush();
        writer.Close();
return "success";
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T12:51:37+00:00Added an answer on June 11, 2026 at 12:51 pm

    File.Create returns a stream, but you’re discarding it.
    So (I think!) you either need to use the returned stream, or explicitly close it before trying to open a new stream to the same file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get unable to open database file when executing rc = sqlite3_open(test.db, &db); ??
I want to insert code for Open Id. I am unable to find article
Is there a way I can just update the apk file after making changes
I'm trying to use a dialog box to open a file in my program.
How come this program does not read a hex file correctly? #include <stdio.h> #include
Hi, i am unable to open Eclipse Ganymede IDE.. It is displaying the message
What is the cause of following error: QSqlDatabasePrivate::database: unable to open database: unable to
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php53/modules/mailparse.so' - /usr/lib64/php53/modules/mailparse.so: cannot open
A file name will be passed in from standard in. I want to open
I've just upgraded my Android dev env up to v15 and I'm unable to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.