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

  • SEARCH
  • Home
  • 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 8184151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:24:11+00:00 2026-06-07T01:24:11+00:00

My Code is try { string mtellThemePath = ConfigurationManager.AppSettings[mtellThemePath] == null ? Server.MapPath(~/App_Themes/) :

  • 0

My Code is

        try
        {
            string mtellThemePath = ConfigurationManager.AppSettings["mtellThemePath"] == null ? Server.MapPath("~/App_Themes/") : ConfigurationManager.AppSettings["mtellThemePath"].Contains("%%") ? Server.MapPath("~/App_Themes") : ConfigurationManager.AppSettings["mtellThemePath"];

            string[] folderPaths = Directory.GetDirectories(mtellThemePath);
            string currentSurveyThemeName = hfSurveyName.Value + "_" + hfClientId.Value;
            string cloneSurveyThemeName = lstSurvey[0].SurveyName + "_" + Identity.Current.UserData.ClientId;
            string cloneSurveyThemePath = mtellThemePath + "\\" + lstSurvey[0].SurveyName + "_" + Identity.Current.UserData.ClientId;

            string cssFile = cloneSurveyThemePath + "\\" + cloneSurveyThemeName + ".css";
            string skinFile = cloneSurveyThemePath + "\\" + cloneSurveyThemeName + ".skin";

            string FileContentCSS = string.Empty;
            string FileContentSkin = string.Empty;

            foreach (string oFolder in folderPaths)
            {
                if (oFolder.Split('\\')[5] == currentSurveyThemeName)
                {
                    string[] cssSkinFiles = Directory.GetFiles(oFolder);
                    foreach (string objFile in cssSkinFiles)
                    {
                        if (objFile.Split('\\')[6].Split('.')[1] == "css")
                        {
                            FileContentCSS = File.ReadAllText(objFile);
                        }
                        if (objFile.Split('\\')[6].Split('.')[1] == "skin")
                        {
                            FileContentSkin = File.ReadAllText(objFile);
                        }
                    }
                }
            }
            Directory.CreateDirectory(cloneSurveyThemePath);
            File.Create(cssFile);
            File.Create(skinFile);
            if (FileContentCSS != string.Empty)
            {
                File.WriteAllText(cssFile, FileContentCSS);
            }
            if (FileContentSkin != string.Empty)
            {
                File.WriteAllText(skinFile, FileContentSkin);
            }
            return lstSurvey[0].SurveyGuid;
        }
        catch (Exception ex)
        {
            throw ex;
        }

It is giving error as:

The process cannot access the file
‘D:\Projects\Mtelligence\Mtelligence.Web\App_Themes\Clone_ForCloneTest_-1\Clone_ForCloneTest_-1.css’
because it is being used by another process.

Please Help me ……….
how to solve this

Iam trying to read .css,.skin files from a folder and write those same files in another folder with different name

  • 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-07T01:24:12+00:00Added an answer on June 7, 2026 at 1:24 am

    Look this:

    File.Create(cssFile);
    File.Create(skinFile);
    if (FileContentCSS != string.Empty)
    {
        File.WriteAllText(cssFile, FileContentCSS);
        // ...
    }
    

    Actually File.Create dos not just create a file but it creates the file and returns an open stream to it. Your subsequent call to File.WriteAllText will try to write a file open by yourself. In you case (because you do not use streams returned by File.Create) simply remove them:

    if (FileContentCSS != string.Empty)
    {
        File.WriteAllText(cssFile, FileContentCSS);
        // ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have database code like this try { string strConnectionString = ConfigurationManager.ConnectionStrings[SqlServerCstr].ConnectionString; SqlConnection myConnection
I use the following code try to create an array of string vectors, I
public void EatDinner(string appetizer, string mainCourse, string dessert) { try { // Code }
Try this code - import java.io.StringReader; public class StringReaderTest { public static void main(String[]
I have following code public class TEST { public static void main(String arg[]){ try
Try this piece of code - public class WhitespaceTest { public static void main(String[]
I try to update database table and this is my code: public void updatefiletable(String
I try to use the following code: ArrayList<String> Map<String, String> Eclipse complains about both
I'm often having code written as follows try: self.title = item.title().content.string except AttributeError, e:
I have the following code: try { reader = new BufferedReader(new FileReader(file)); String records

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.