Monday, August 13, 2012

How to store a dictionary object in web.config?

<configuration>
  <configSections>
    <section
      name="MyDictionary" type="System.Configuration.NameValueFileSectionHandler,System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  </configSections>
  <MyDictionary>
     <add key="name1" value="value1" />
     <add key="name2" value="value2" />
  </MyDictionary>
</configuration>
NameValueCollection section = (NameValueCollection)ConfigurationManager.GetSection("MyDictionary");

Publishing Improvements, chained Config Transforms and Deploying ASP.NET Apps from the Command Line

http://www.hanselman.com/blog/TinyHappyFeatures3PublishingImprovementsChainedConfigTransformsAndDeployingASPNETAppsFromTheCommandLine.aspx


msbuild MySolution.sln /p:DeployOnBuild=true;PublishProfile=%1;AllowUntrustedCertificate=true;Password=poo

Validate Image Type Using Image GUID in ASP.NET

http://www.codeproject.com/Tips/409328/Validate-Image-Type-Using-Image-GUID-in-ASP-NET

System.Drawing.Image image = System.Drawing.Image.FromStream(FileUpload1.FileContent);
        string FormetType = string.Empty;
        if (image.RawFormat.Guid == System.Drawing.Imaging.ImageFormat.Tiff.Guid)
            FormetType = "TIFF";
        else if (image.RawFormat.Guid == System.Drawing.Imaging.ImageFormat.Gif.Guid)
            FormetType = "GIF";
        else if (image.RawFormat.Guid == System.Drawing.Imaging.ImageFormat.Jpeg.Guid)
            FormetType = "JPG";
        else if (image.RawFormat.Guid == System.Drawing.Imaging.ImageFormat.Bmp.Guid)
            FormetType = "BMP";
        else if (image.RawFormat.Guid == System.Drawing.Imaging.ImageFormat.Png.Guid)
            FormetType = "PNG";
        else if (image.RawFormat.Guid == System.Drawing.Imaging.ImageFormat.Icon.Guid)
            FormetType = "ICO";
        else

A straightforward method to detecting RSS and Atom feeds in websites with HtmlAgilityPack

http://runtingsproper.blogspot.co.uk/2012/07/a-straightforward-method-to-detecting.html