Search This Blog

Saturday, July 13, 2013

Non-invocable member 'System.Configuration.ConfigurationManager.AppSettings' cannot be used like a method.

Non-invocable member 'System.Configuration.ConfigurationManager.AppSettings' cannot be used like a method.

Web.config file code:
<appSettings>
    <!-- Custom settings for application -->
    <add key="AppName" value="askdotnet.com" />
    <add key="AppTitle" value="Welcome to askdotnet.com" />
    <add key="AUTHORIZE_NET_API_LOGIN" value="http://askdotnet.com" />
    <add key="ServicesServer" value="http://askdotnet.com" />
    <add key="XBEServer" value="http://askdotnet.com" />
  </appSettings>
cs page code:

Error no 1.
Non-invocable member 'System.Configuration.ConfigurationManager.AppSettings' cannot be used like a method.
Issue no 1.
strAuthorizeNet_x_login = System.Configuration.ConfigurationManager.AppSettings("AUTHORIZE_NET_API_LOGIN");
Solutions no 1:
strAuthorizeNet_x_login = System.Configuration.ConfigurationManager.AppSettings["AUTHORIZE_NET_API_LOGIN"];

Error no 2.
This method is absolete....
Issue no 2.
strAuthorizeNet_x_login = System.Configuration.ConfigurationSettings.AppSettings("AUTHORIZE_NET_API_LOGIN");
Solutions no 2:
strAuthorizeNet_x_login = System.Configuration.ConfigurationManager.AppSettings["AUTHORIZE_NET_API_LOGIN"];


No comments :