Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an asp.net application in which I am writing log for any exception occurs in methods.

My Application LOcatio is

D:\MyProjectes

But I have log directory in side the application

D:\MyProjects\Logs

I have set Error Log Path in Web Config like below--


<appsettings>
<add key="ErrorLog" value="D:\MyProjects\logs" />


Its Working Fine but When I have hosted application on Plesk Server

Then How to set the Directory LOcation on server

PLease Suggest

What I have tried:

I have Added on Local Server (On MY System)

<appsettings>
<add key="ErrorLog" value="D:\MyProjects\logs" />


But I want to set above setting on server--
then how to do that.
Posted
Updated 11-Sep-18 2:14am

You will have to ask the company that is hosting your site. You'll need permissions granted to write to a folder and then you'll need the path of that folder.
 
Share this answer
 
Change your code to support virtual folders rather than hard-coded paths. So use "~/logs" to represent the "logs" folder in the root of your site rather than "d:\myprojects\logs" and you can map that value to a folder using

string logFolder = Server.MapPath("~/logs")


That way it will work no matter what server you put it on as MapPath will work out the absolute folder path for you. You're probably better storing this folder in App_Data as well so "~/App_Data/logs"
 
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