How to get application Domain name

The following code is used to get the current application domain details
The bellow code is very simple but it is very useful for us.

Namespace part


using System;
using System.Reflection;
using System.Windows.Forms;


Code Part


public class CurrnetAppDomain
{
public static void Main(string[] args)
{
AppDomain MyAppDomain = AppDomain.CurrentDomain;
Assembly[] MyAssemblies = MyAppDomain.GetAssemblies();

foreach(Assembly Myasmy in MyAssemblies)
{
Console.WriteLine(Myasmy.FullName);
}
}
}



Code Explanation

1. Create the instance of the AppDomain using Current Domain
2. Store the assemblies in the Assembly array
3. Useing for each we can get the name of the Application domain

By
Nathan


Comments

Guest Author: joejoe14 Jun 2012

This code DOES NOT get application Domain name of a given application, it returns ALL application domains running on the server.



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: