Home > Forum > ASP.NET > How to store and Get File Path Using AppSettings web.config file

How to store and Get File Path Using AppSettings web.config file

by Thamil   on Aug 29, 2013   Category: ASP.NET  |  Views: 8462    |  Points: 5   |  Gold 
  Reply
Hi Friends,

How can i get File path from web.config using App Directive.

Thanks in Advance,
DeepikaYuvaraj.

Question posted on behalf of DeepikaYuvaraj

Bookmark and Share:
 
  User Reply  | Ask a question  |   Reply 
  Re :How to store and Get File Path Using AppSettings web.config file   
by Thamil
on Aug 29 2013 2:22AM
Points : 10
Gold 
Hello DeepikaYuvaraj,

This is easy to store and retrieve information from web.config file in asp.net applications, see the below steps.

In Web.config file

Add the key name and value in the appsettings and provide the path information in value.
 <appSettings>
<add key="FilePath" value="C:/UploadedFiles"/>
</appSettings>

Code behind part

To get this path from config file , add the below namespace

using System.Configuration;

protected void Page_Load(object sender, EventArgs e)
{
string Path = ConfigurationManager.AppSettings["FilePath"].ToString();
}


Hope this will help you.

Recent Post

Latest Posts