TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
jasminie
NA
78
0
Error in C#.net class library code
Aug 31 2011 1:24 PM
Can you tell me what is wrong with this code?
In an exisitng C#.net 2008 desktop application, I want to setup a class .cs file so I can do security checks against the active directory. I want to add this code to a project file that contains lots of common routines all the other processing modules use. The code is the following:
using System;
using System.Reflection;
using System.Runtime.Remoting;
using System.IO;
using System.Threading;
using System.Windows.Forms;
using System.Security.Principal;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace En.Common
{
class ActiveDirectory
{
AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
//Thread.CurrentPrincipal = new WindowsPrincipal(WindowsIdentity.GetCurrent());
//if ((!Thread.CurrentPrincipal.IsInRole("testit")))
}
}
I want to start with 3 lines of code listed so far. However, the statement,
AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
However I am getting the following two errors on this statement:
Error 94 Invalid token '(' in class, struct, or interface member declaration
Error 95 Invalid token ')' in class, struct, or interface member declaration
what is wrong with the code?
Reply
Answers (
1
)
Counting Date Fields
Synchronizing two SQL tables