is no Web.Config variable retrieval occuring at the private variable
declaration stage, e.g.
private string myString =
System.Configuration.ConfigurationManager.AppSettings["myString"].ToString();
where a Web.Config value that matches has not been declared in the
Web.Config file itself.
A far better practise is to retrieve such variables at the page load
stage, or in the constructor of your class, i.e.
private string myString = "";
public MyClass()
{
myString = System.Configuration.ConfigurationManager.AppSettings["myString"].ToString();
}
3 comments:
when creating a guid if you pass in a null or empty string you can get the above error. i.e.
Guid g = new Guid("");
or
Guid g = new Guid(null);
Thanks man. The Guid(null) was the key to it.
Muchas gracias por su ayuda, El Guid(null) Era la causa del error en mi aplicaciĆ³n.
Post a Comment