Console
How to get Windows Login credentials using C#.Net , ASP.Net
5one of the most famous topics is how we can know the current user credential like
user name, Groups, Authentication Type (I hope to find a way to know password
)
check this code
Console.WriteLine("AuthenticationType =" + WindowsIdentity.GetCurrent().AuthenticationType); Console.WriteLine("Name ="+WindowsIdentity.GetCurrent().Name); Console.WriteLine("Groups :"); foreach (IdentityReference ir in WindowsIdentity.GetCurrent().Groups) { Console.WriteLine(ir.Translate(typeof(NTAccount)).ToString()); }
and this a another way to get Windows Identity
WindowsPrincipal p = Thread.CurrentPrincipal as WindowsPrincipal; (p.Identity as WindowsIdentity)
and for ASP.Net
HttpContext.Current.User.Identity
for more information
Windows Principal , Windows Identity
Nice Start with Project Euler
0Today I have Start to solve problems in Project Euler
It is really amazing website to start practice your self in programming tricks and also mathematics
I solve the first problem which was very easy , it can be solved by many ways and more simpler than my way
but I love .net 3.5
Here is my solution
var numbers = from number in Enumerable.Range(0, 1000) where ((number % 3 == 0) || (number % 5 == 0)) select number; var answer = numbers.Sum(); Console.WriteLine(answer);
How to make Console Programs Interactive
3Hello every body
I had to make console programs every time, you know console screen is very poor.
So ,I write Small Helper Class to make console program more interactive with user.
This Class helps me to make menus, read some Primitive data types and also reading them in some range
this the class Diagram of Console Helper Class
and this the code Download Code
any way
here is my work
I need your Comments
