asp.net - How to get the file path using key from webconfig file -


i have json file stored in d drive. have mentioned same in web config file. please refer below code

    <appsettings>     <add key="inputfilepath" value="d:\products.json"/>     </appsettings>  

when try file path using below code, getting null value.

    string filepath = configurationmanager.appsettings["inputfilepath"]; 

please can 1 me on this

you need call this

string filepath = configurationmanager.appsettings["inputfilepath"].tostring(); 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -