Home > General > Read web.config file from webpart

Read web.config file from webpart

// try reading the web.config file of context webapplication
SPWebApplication contextWebApp = SPWebApplication.Lookup(new Uri(SPContext.Current.Web.Url));
var config = WebConfigurationManager.OpenWebConfiguration(“/”, contextWebApp.Name);
string configFilePath = config.ConnectionStrings.ConnectionStrings[“PearlSPGridViewConnectionString”].ToString();

Categories: General
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: