Archive

Archive for May, 2012

The vNext of Visual Studio is Visual Studio 2012?


There was a lot of speculation about the official name of the next version Visual Studio. Presentations by Microsoft employees, MSDN pages, magazines …etc refer to it by Visual Studio 11 or VS11 where 11 is the version number

Few moments ago, I visited the C# reference page and I noticed the following

image

So is it the official name?

Advertisements
Categories: 2012 Tags: ,

Read Authorization section from Web.config


In my current project, I had to read the find the Windows group for the ESB portal which can be found in the authorization section of the web.config for the ESB portal. I used the following code to read it:

var config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(“/Bam”, “Default web Site”);
var section = config.GetSection(“system.web/authorization”) as AuthorizationSection;

if (section == null)
{
    return string.Empty;
}

foreach (AuthorizationRule rule in section.Rules)
{
     if (rule.Action.ToString().ToLower() == “allow” && rule.Roles.Count > 0)
     {
        foreach (var item in rule.Roles)
        {
            if (item != “*”)
            {
                return rule.Roles[0];
            }
        }
    }
}
return string.Empty;

[/soucecode]

Categories: .NET, asp.net, C#, Tips Tags: , ,