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 988627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:39:51+00:00 2026-05-16T05:39:51+00:00

When I try to run .aspx page with next code: System.IO.File.Delete(~/img/afisha/ + fileName); it

  • 0

When I try to run .aspx page with next code:

System.IO.File.Delete("~/img/afisha/" + fileName);

it writes a message: “Could not find a part of the path ‘C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\~\img\afisha\brs_01.jpg’.”
But I need to use relative path.

ps. the same thing happens with the connection string: <add name="accessConStr" connectionString="Provider=Microsoft.ACE.OLEDB.12.0; data source=ExpertBase.mdb; Persist Security Info=False;" providerName="System.Data.OleDb"></add>

Any ideas? (and will it work on the server properlly?)

  • 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-05-16T05:39:51+00:00Added an answer on May 16, 2026 at 5:39 am

    Try Server.MapPath()

    System.IO.File.Delete(Server.MapPath("~/img/afisha/" + fileName));
    

    for the connection string you can try using a variable string instead

    internal readonly string CONNECTION_STRING = "Provider=Microsoft.ACE.OLEDB.12.0; data source={0}; Persist Security Info=False;"
    
    internal static string ConnectionString
    {   
        get 
        { 
             return string.Format(CONNECTION_STRING, 
                 Server.MapPath("~/ExpertBase.mdb")); 
        } 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to let an aspx.cs file run code to enumerate the contents of
this question on google authentication when i try to run below code page successfully
I try to run the following code: public void Init(Url rootUrl) { var web
I try to run a simple Hello World ASP.NET web site on my system,
the software contains one functional master page which has many ASPX file under these
I try run jconsole with jar that contains my classes like: cd C:\Program Files\Java\jdk1.6.0_26\bin
I'm getting this error when I try run DB:Rake : ** Invoke db:migrate (first_time)
I try to run a medium sized programm with a lot of external jars
I try to run the following raw query in android, it seems not work
I try to run jsf application in myeclipse using jboss web server and following

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.