Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

In my project am using encryption method. For encryption, i have a public file(.asc) which contain public key. I stored this file in file folder of my solution. Path will be like (My solution\ProjectName\FolderName\publicFile.asc). The application is a console application.

When i deploy this solution in one of the server and run the batch job am not able to locate my publicFile path.

I know by using AppDomain.CurrentDomain.BaseDirectory will give the bin folder. But what i want is a solution folder. How do i achieve this? Please help me on this.

[I also used Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory())) to get the path, its working fine in local but not in server]
Posted

1 solution

Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase

Why? On the server, the executable is copied to a temporary folder and executed there.
 
Share this answer
 

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