I am facing an issue with getting a value from Web.config.
Here is my web.config code which contains Key
<appSettings>
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="Email" value="myname@mydomain.com" />
i want email key value, i am writing,
string From = ConfigurationManager.AppSettings["Email"].ToString();
but its giving me error "Object reference is not set to an instance of an object"
My other web.config declarations are:
<system.net>
<mailSettings>
<smtp>
<network host="smtp.gmail.com" port="***" enableSsl="true" defaultCredentials="false" userName="myname@mydomain.com" password="mypassword" />
</smtp>
</mailSettings>
</system.net>
Any help appreciated! Thanks!