Setting the default document for you’re ASP .NET website or webservice, by using the Web.config

If you want to set the default document for you’re ASP .NET website or WCF webservice, you can use the Web.config. Add the following XML to you’re Web.config just before the end tag: </configuration> <system.webServer> <defaultDocument> <files> <add value="MyWcfService.svc" /> </files> </defaultDocument> </system.webServer>   

How to resolve: "Unrecognized attribute ‘targetFramework’. Note that attribute names are case-sensitive"

I was getting the error "Unrecognized attribute ‘targetFramework’. Note that attribute names are case-sensitive" on an ASP .NET 4.0 website. This was caused by the application pool targeting the wrong .net framework, change the application pool to the correct .net framework and the error will be resolved.   Error Solution

How to dynamically set the connectionstring of a typed dataset (*.xsd file) when using an ObjectDataSource in ASP .NET

If you are using a typed dataset (*.xsd) and you want to set it’s connection string, you can use the ObjectDataSource event OnObjectCreated.   protected void MyObjectDaDataSource_OnObjectCreated(object sender, ObjectDataSourceEventArgs e) { if (e != null && e.ObjectInstance != null) { SqlConnection connection = new SqlConnection("Data Source=SQLServerInstanceName1;User ID=User1;Password=Password1;Initial Catalog=Database1;"); e.ObjectInstance.GetType().GetProperty("Connection", BindingFlags.NonPublic …