Click here to Skip to main content
16,004,833 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,


I have an .jpeg file in the application folder, to access that file I have given the path as "../image1.jpeg". Its working fine when I am executing it.
but at the time of deployment, I could see the error "Could not find the part of path "../image1.jpeg" ".

The application is in windows application.
I have tried in google but I couldn't get correct solution

Please let me know, how can I access that path at the time of deployment.
Posted
Updated 31-Jul-13 1:07am
v2
Comments
Dheeraj_Gupta 31-Jul-13 7:04am    
please share your code snippet.
Did you use Server.MapPath ?
sri4dotnet 31-Jul-13 7:09am    
The application is a windows application
Harshil_Raval 31-Jul-13 7:10am    
You said your application in Windows application. What you mean by deployment? are you creating exe of your project?
sri4dotnet 31-Jul-13 7:12am    
I mean to say, I have published the application and I was ruuning the .application file from the published folder, there I could see the error

1 solution

Use the Startup Path and place the image relative to this path.
E.g. string exePath = Application.StartupPath + "\image";
 
Share this answer
 
Comments
lukeer 31-Jul-13 7:41am    
Prefer System.IO.Path.Combine() over string concatenation.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900