Microsoft

Released: Microsoft® Silverlight™ 4 SDK – 4.0.50826.0 (September 2010)

September 2, 2010 All, General, Microsoft SDKs, Silverlight No comments

Microsoft has today released the latest version of Microsoft® Silverlight™ 4 SDK – Version: 4.0.50826.0. This is the latest September 2010 released on 09/01/2010.

The Microsoft® Silverlight™ 4 SDK contains online documentation, online samples, libraries and tools for developing Silverlight 4 applications.

Usage of the SDK is subject to the SDK License (included in the package).

Download Microsoft® Silverlight™ 4 SDK – 4.0.50826.0

Using External Configuration Files in .NET Applications (C#)

August 31, 2010 .NET, All, Back-2-Bascis, C#.NET, Codes, KnowledgeBase, Microsoft 3 comments

This post is about making a small code snippet which read from an external configuration file and get the custom configuration entries from it.

I went through the solutions. My target was to checkout how we can use the external configuration files in an ASP.NET Web.config. The idea is that there are more than one web application is there in my own Virtual Organization. I thought of keeping a common configuration file for all those web application. So that I have to change configuration only in one place, from time to time changes.

1. Scenario 1 :- ASP.NET Application

Here is the solution I came across.

External configuration file(External.config), which will have some set of AppSettings key value pairs.

<?xml version="1.0"?>

<appSettings>

  <add key="Web_App_Name" value="Dream Works India"/>
  <add key="Web_App_ID" value="E1635BA6-0714-4496-A852-18868A0EB591"/>
</appSettings>

ASP.NET Web.config (Which refering to an external config file with name “External.config”)

<?xml version="1.0"?>
<configuration>
	<appSettings configSource="External.config"> <!-- Refering to an External Config File, You should specify the relative path -->
    
	</appSettings>
  
	<system.web>
		<compilation debug="true"/>
  </system.web>

</configuration>


Note: One thing you should make sure is that, in ASP.NET you have to mention the External config file’s relative path. It will not accept if i keep like “C:External.config”

ASP.NET – C# Code (for reading from external config file)

 

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.Configuration;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace DreamWebSiteMain
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string Web_App_Name = WebConfigurationManager.AppSettings["Web_App_Name"];
            string Web_App_Id   = WebConfigurationManager.AppSettings["Web_App_ID"];


            string str = string.Empty;
        }
    }
}

That’s it. We are ready, here is the output i captured while debugging.

2. Scenario 2 :- Console/Windows Application

Here case is bit different from ASP.NET, you cannot simply specify in App.config file. Windows/Console Application would n’t work that way.

You will receive an exception if you try the same in console/windows application.

Error:- “Unable to initialize the configuration entries”
.

So what is other option we have. I came across a code-project article(link Specify a Configuration File at Runtime for a C# Console Application. That was really informative and thoughtful.

So i made slight changes to the code and implemented for my scenario.

External configuration file(C:External.config), which will have some set of AppSettings key value pairs.

<?xml version="1.0"?>

<appSettings>

  <add key="Web_App_Name" value="Dream Works India"/>
  <add key="Web_App_ID" value="E1635BA6-0714-4496-A852-18868A0EB591"/>
</appSettings>

Console Executable App.config (Which will not refering to an external config file with name “External.config”, leave it empty)

<?xml version="1.0"?>
<configuration>
	<appSettings > <!-- forget about linking external config here -->
    
	</appSettings>
  
	<system.web>
		<compilation debug="true"/>
  </system.web>

</configuration>


Note: One thing you should make sure is that, in ASP.NET you have to mention the External config file’s relative path. It will not accept if i keep like “C:External.config”

Console Application – C# Code (for reading from external config file)

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace DreamConsoleApp
{
    class Program
    {
        /// <summary>
        /// Mains the specified args.
        /// </summary>
        /// <param name="args">The args.</param>
        static void Main(string[] args)
        {
            SetConfigFileAtRuntime(@"C:External.config");  

            string Web_App_Name = ConfigurationManager.AppSettings["Web_App_Name"];
            string Web_App_Id = ConfigurationManager.AppSettings["Web_App_ID"];
            

            string str = string.Empty;
        }


        /// <summary>
        /// Sets the config file at runtime.
        /// </summary>
        /// <param name="configFilePath"></param>
        protected static void SetConfigFileAtRuntime(string configFilePath)
        {
            string runtimeconfigfile;

            if (configFilePath.Length == 0)
            {
                Console.WriteLine("Please specify a config file to read from ");
                Console.Write("> "); // prompt
                runtimeconfigfile = Console.ReadLine();
            }
            else
            {
                runtimeconfigfile = configFilePath;
            }

            // Specify config settings at runtime.
            System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

            //Similarly you can apply for other sections like SMTP/System.Net/System.Web etc..
            //But you have to set the File Path for each of these 
            config.AppSettings.File = runtimeconfigfile;

            //This doesn't actually going to overwrite you Exe App.Config file.
            //Just refreshing the content in the memory.
            config.Save(ConfigurationSaveMode.Modified);

            //Refreshing Config Section
            ConfigurationManager.RefreshSection("appSettings");
        }

    }
}

That’s it. We are ready to go, here is the output i captured while debugging.

Voila!!!! Everything working as expected. I got the implementations for ASP.NET and Windows/Console App.

Hope this helps. I couldn’t get much time to do proper formatting. Hope you folks don’t mind the beauty of the code.

Happy Learning !!!!

Microsoft Chart Controls

February 8, 2010 .NET, .NET Framework, All, ASP.NET, General, Microsoft, WinForms No comments

This is a blog extract on ASP.NET/WinForms chart controls on ScottGu’s blog Built-in Charting Controls (VS 2010 and .NET 4 Series)..

The Microsoft Chart Controls are some predefined controls for ASP.NET and Windows Forms released by Microsoft as part of .NET.  There controls facilitates us the programming and  display of Charts and Diagrams in our ASP.NET Pages and Windows Forms.

The Microsoft Chart Controls offer all of the standard chart types – line charts, bar charts, pie charts, and so forth – as well as more specialized ones, like pyramid and bubble charts. The Chart Controls suite offers a comprehensive set of charting features, including support for multiple series, customizable legends, trend lines, and labels. And the Chart Controls API makes it easy to sort, search, filter, group, and export the chart data. Unfortunately, this first version of the Chart Controls has limited support for customizing the chart from the Designer. There are no wizards to guide you through customizing the chart’s look and feel and specifying its data source. Instead, you have to set the properties and bind the chart data yourself.

Microsoft has release ASP.NET/WinForms chart controls as an addin  to Visual Studio 2008 and .NET Framework 3.5, this was included as a separate extension, which you need to download and install from Microsoft Downloads.

Required files/setups you need to download from microsoft  for utilizing these controls are

  • Microsoft Chart Controls - the assemblies (DLLs) that provide the core functionality for the ASP.NET and WinForms Chart Controls. When you download and execute this program (MSChart.exe), the installer places the assemblies in the Program FilesMicrosoft Chart ControlsAssemblies folder; it also adds them to the Global Assembly Cache (GAC), meaning that you can use the Chart Controls from any ASP.NET application on the server without having to add the DLL files to the application’s /Bin folder. (If you are hosting your application in a shared hosting environment and the web server does not have the Chart Controls installed then you will need to upload these assemblies to the /Bin folder in your hosted environment.)
  • Microsoft Chart Controls Add-on for Microsoft Visual Studio 2008 - adds Toolbox and IntelliSense support for the Chart Controls in Visual Studio 2008.
  • Samples Environment for Microsoft Chart Controls - click the Download tab and then download the ASP.NET Samples. The samples are packaged into a website project and include demos and source code (in VB and C#) for the various chart types and charting features.

In the latest Visual Studio 2010 and Microsoft .NET Framework 4.0, you can see that Microsoft Chart Controls are integrated to the Visual Studio 2010 and .NET Framework 4.0 packages itself. So we no longer needed to download a separate setup files to install these controls.

You can simply Install the Visual Studio 2010 and start developing the application right away..

For learning Microsoft Chart Controls, You can find an interesting Article by Scott Mitchell in 4 Guyz From Rolla.com , as mentioned by Scott Guthrie.

  1. Getting Started - walks through getting started using the Chart Controls, from version requirements to downloading and installing the Chart Controls, to displaying a simple chart in an ASP.NET page.
  2. Plotting Chart Data - examines the multitude of ways by which data can be plotted on a chart, from databinding to manually adding the points one at a time.
  3. Rendering the Chart - the Chart Controls offer a variety of ways to render the chart data into an image. This article explores these options.
  4. Sorting and Filtering Chart Data - this article shows how to programmatically sort and filter the chart’s data prior to display.
  5. Programmatically Generating Chart Images - learn how to programmatically create and alter the chart image file.
  6. Creating Drill Down Reports - see how to build drill down reports using the Chart control.
  7. Adding Statistical Formulas - learn how to add statistical formulas, such as mean, median, variance, and forecasts, to your charts.
  8. Enhancing Charts With Ajax - improve the user experience for dynamic and interactive charts using Ajax.

His articles are written using .NET 3.5 and the separate ASP.NET charting controls download – but all of the concepts and syntax work out of the box exactly the same with ASP.NET 4.

Spend some time to read it, and try out the basic examples..

Thanks to my All time Mentor - Scott Guthrie, for all his articles, which inspire me to learn .NET in depth. I am not an expert, but i know some parts of it.

and

Courtesy and Thanks to ScottGu, Scott Mitchel and 4 Guyz from Rolla.com

Free 60 Controls from DevExpress

December 30, 2009 .NET, .NET Framework, All, ASP.NET, ASP.NET AJAX, ASP.NET MVC, Azure Tools, C#.NET, General, Microsoft, VB.NET, VisualStudio, VS2010 No comments

DevExpress is  offering us over 60 DevExpress controls free of charge – without royalties or distribution costs.

These free license includes the following DevExpress products for WinForms, ASP.NET and Silverlight platforms:

To obtain your free DevExpress controls Visit Link

Windows Azure Platform Training Kit – December Update

December 29, 2009 .NET, .NET Framework, All, ASP.NET, ASP.NET AJAX, ASP.NET MVC, Azure Tools, C#.NET, General, Microsoft, VB.NET, VisualStudio, VS2010 No comments

The Azure Services Training Kit includes a comprehensive set of technical content including hands-on labs, presentations, and demos that are designed to help you learn how to use the Windows Azure platform including: Windows Azure, SQL Azure and AppFabric. The December release includes new and updated labs in addition to information about Microsoft Codename “Dallas”.

File Name: WindowsAzurePlatformKit.Setup.exe
Version: December Update
Date Published: 12/23/2009
Language: English
Download Size: 122.4 MB

Hands On Labs

  • Introduction to Windows Azure
  • Exploring Windows Azure Storage
  • Deploying and Monitoring Applications in Windows Azure
  • Windows Azure: Worker Role Communication
  • Federated Authentication in a Windows Azure Web Role Application
  • Building ASP.NET Web Form Applications with Windows Azure
  • Introduction to SQL Azure
  • Migrating Databases to SQL Azure
  • SQL Azure: Tips and Tricks
  • Intro to Dallas
  • Introduction to the .NET Service Bus
  • Introduction to the .NET Access Control Service
  • Service Remoting with Service Bus
  • Eventing with the Service Bus

and more…

For more information VISIT LINK 

dasBlog :: an open source blogging platform for ASP.NET 2.0

December 29, 2009 .NET, .NET Framework, All, ASP.NET, ASP.NET AJAX, ASP.NET MVC, Azure Tools, C#.NET, General, Microsoft, VB.NET, VisualStudio, VS2010 No comments

dasBlog

Is an open source content management system(CMS) developed using asp.net and it will running on ASP.NET 2.0.

Microsoft has has included it as part of “Microsoft Web Platform Installer 2.0”..

It’s FEATURE Rich like all other content management systems available in Web. Simple and Elegent to design..

FEATURES (as per dasBlg website)

Anti-Spam Features

  • Automatic Referral and Trackback blacklist update
  • CAPTCHA for non-admin users (Font warping has also been increased in this version)
  • Logging and display of Comment IP addresses and resolved Hostnames for Admins
  • DasBlogUpgrader can strip spam from existing content folders
  • Support for rel=”nofollow”
  • Ability to delete referrals and trackbacks directly from the Admin UI
  • Delete comments directly from your mail reader
  • Comment moderation option
  • RSS Emails removed to avoid having email addresses stolen from Feeds
  • Support for AKISMET (next release)

Security Features

  • HttpOnly cookies
  • Admin access auditing
  • SMTP Authentication for outgoing mail

Syndication Features

  • Improved RSS Comments support for SharpReader and RSS Bandit
  • Upgraded Atom support from 0.3 to Valid Atom 1.0. ATOM Syndication permalink changes but 301 is issued.
  • RSS 2.0 and Atom 1.0 validates via FeedValidator.
  • Ability to mark entries as “syndicated” or not. Entries can appear on the site but not in RSS/Atom.
  • New between RC1 and Gold: Plugable, configurable pinging of Blog Search engines like pubsub and technorati.
  • Channel Image feature (RSS Bug)
  • Direct Feedburner Support with 301 redirection for RSS and Atom feeds.

Performance Features

  • Search Highlighting is optional now
  • Referrals are logged but not stored in XML by default. Configurable.
    (This has huge performance benefits for high traffic sites.)
  • dasBlog Upgrader can optionally remove all referrals.
    (Again with high traffic sites some folks had 5meg XML files full of referrals)
  • Theme templates are now cached in memory.
  • Log files are archived daily to .zip files.
  • Support for Really Simple Discovery (RSD) so client software can autoconfigure itself
  • Support for alternate SMTP ports

Installation Features

  • VBS for IIS permissions and VDir creation
  • Support for running under ASP.NET 2.0
  • Support for running on Win2k 2003 without changing permissions when impersonation is enabled
  • dasBlogBlogXContentImporter tool

Content Features

  • Ability to pre- and post-date entries
  • Cross Posting (post is added two blogs at once)
  • Permalinks based on Title and Date optional: 2005/06/06/title.aspx
  • Latest build of Free Text Box including ability to upgrade FTB without upgrading DasBlog.
  • Text Editor (FTB) supports IE7
  • Text Editor (FTB) supports FireFox
  • Blog Statistics Log
  • Blog Statistics macro
  • Archive pages macro
  • macro for items disclaimer
  • macro for homePageTemplate disclaimerLink
  • Mail-To-Weblog continues to improves. Works with Thunderbird.
  • Upload Image and Upload Attachment
  • Comments can now be “closed” for a given Entry
  • Entries can be set to IsPublic (i.e. working drafts before release)
  • Large calendar view with posts
  • Blogroll.aspx for rendering your blogroll.opml file
  • TrackBack Autodiscovery is attempted before PingBack Autodiscovery
  • Pingbacks from one dasBlog to another dasBlog work
  • TagCloud Support
  • Support for Mobile Browsers like Blackberries and SmartPhones
  • Top Posters macro and total comments
  • Macros for Next Post and Previous Post
  • Macro for Category Paging (next release)
  • Support for Gravatars
  • Support for limited HTML markup in comments
  • Email page for leaving comments to the author, includes Captcha
  • Pluggable Rich Text Editor, choose from the latest version of FreeTextBox or FCKEditor or write your own adapter
  • Multi-user/blogger support
  • Emailed Daily Activity Reports
  • Support for Blogging directly from Word 2007
  • DHTML Timeline of Posts from the MIT Simile project
  • Support for SMTP Servers like Gmail for notifications (and alternate SMTP ports)
  • LiveComment Preview
  • Category and Home Page Paging Macros

Extensibility Features

  • Custom Macro Plugin model without recompiling DasBlog (see the source for the example custom macro)
  • Works with Windows Live Writer out of the box
  • Support for CoComment
  • Microsummary support for Firefox 2.0 Beta
  • Automatic generation of Google SiteMaps
  • Automatic disabling of Comments after a certain number of days. Also manual “close comments” support
  • ContentLookAhead show future dated posts
  • Ajax Autosave Drafts support

Theme Features

  • dasBlog now ships with 24 themes and a Theme Combo to change between them.
  • theme.manifest file makes themes and image assets more portable.
  • dasBlog Badges/Artwork

Architecture

  • ASP.NET 2.0, C#
  • Medium Trust model
  • Operational under ASP.NET 2.0 and ASP.NET 3.0
  • Structured XML data store
  • Supports template themes (Ships with over 24)

To download and Give it a try visit here

Please note: You can now install dasBlog 2.3 and future versions via the Microsoft Web Platform Installer