Click here to Skip to main content
15,905,504 members
Home / Discussions / C#
   

C#

 
AnswerRe: Problem on Update operation Pin
Mycroft Holmes1-Jul-13 12:48
professionalMycroft Holmes1-Jul-13 12:48 
QuestionControling Video files Pin
ErfanNoury30-Jun-13 22:50
ErfanNoury30-Jun-13 22:50 
AnswerRe: Controling Video files Pin
N a v a n e e t h1-Jul-13 0:28
N a v a n e e t h1-Jul-13 0:28 
SuggestionRe: Controling Video files Pin
Manimaran Adelasoft2-Jul-13 0:16
professionalManimaran Adelasoft2-Jul-13 0:16 
Questionhow to prevent unnecessary callback in c# for a mouse click Pin
srinimuk30-Jun-13 19:05
srinimuk30-Jun-13 19:05 
AnswerRe: how to prevent unnecessary callback in c# for a mouse click Pin
Jean A Brandelero1-Jul-13 4:41
Jean A Brandelero1-Jul-13 4:41 
AnswerRe: how to prevent unnecessary callback in c# for a mouse click Pin
Manu V Nath3-Jul-13 23:32
professionalManu V Nath3-Jul-13 23:32 
QuestionC# desktop use active directory group Pin
dcof30-Jun-13 4:33
dcof30-Jun-13 4:33 
I have a C# 2010 desktop application where I have code setup to see if a user is a member of an active directory group. I am using WindowsIdentity to check the current users active directory group level. The following code is not working. Thus can you tell me how to what is wrong with the code below?

If you think the code listed below will not work, can you tell me how you would modify the code listed below?

If you do no see anything wrong, can you tell me what to suggest to the network people at my company to suggest to them what is wrong?
using ActiveDirectoryCommon; 
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Windows.Forms; 
using System.Collections.Specialized; 
using System.Deployment.Application; 
using System.Diagnostics; 
using System.Reflection; 
using System.Runtime.Remoting; 
using System.IO; 
using System.Web; 
using System.Configuration; // required to obtain the values from the 
ConfigurationManager.Appsettings in the app.config file 
using System.Security.Principal; 
using System.Threading; 
 
 
namespace File_Reject 
{ 
    static class Program 
    { 
        /// <summary> 
        internal static ActiveDirectoryUser CurUser; 
        [STAThread] 
      
 
        static void Main() 
          { 
              try 
              { 
              Application.EnableVisualStyles(); 
             Application.SetCompatibleTextRenderingDefault(false); 
             CurUser = new ActiveDirectoryUser(); 
             if 
(!Thread.CurrentPrincipal.IsInRole(Environment.UserDomainName + "\\" + ConfigurationManager.AppSettings["role_File_Upload"])) 
              { 
                MessageBox.Show("You do not have authortity to access File Transfer. Please contact your network administrator if you have any 
questions.", "File Transfer Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 
                      return; 
                  } 
                  Application.Run(new FileReject()); 
              } 
                catch (Exception e) 
              { 
                  //console.write(e.Message); 
                 
              } 
 
        } 
    } 
} 
---------- 

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Diagnostics; 
using System.Reflection; 
using System.IO; 
using System.Threading; 
using System.Web; 
using System.Windows.Forms; 
using System.Security.Principal; 
 
 
namespace ActiveDirectoryCommon 
{ 
    public class ActiveDirectoryUser 
    { 
        public ActiveDirectoryUser() 
        { 
            
AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal); 
            Thread.CurrentPrincipal = new WindowsPrincipal(WindowsIdentity.GetCurrent()); 
        } 
    } 
} 
-----------
<?xml version="1.0"?> 
<configuration> 
 
  <appSettings> 
    <add key="role_File_Upload" value="File_Upload" /> 
  </appSettings> 

</configuration> 
------------ 

AnswerRe: C# desktop use active directory group Pin
Richard MacCutchan30-Jun-13 7:06
mveRichard MacCutchan30-Jun-13 7:06 
GeneralRe: C# desktop use active directory group Pin
dcof30-Jun-13 12:01
dcof30-Jun-13 12:01 
GeneralRe: C# desktop use active directory group Pin
Richard MacCutchan30-Jun-13 21:17
mveRichard MacCutchan30-Jun-13 21:17 
AnswerRe: C# desktop use active directory group Pin
Ron Nicholson1-Jul-13 4:15
professionalRon Nicholson1-Jul-13 4:15 
QuestionParse CSV using RegularExpression Pin
haha_c28-Jun-13 23:32
haha_c28-Jun-13 23:32 
AnswerRe: Parse CSV using RegularExpression Pin
Richard MacCutchan29-Jun-13 0:58
mveRichard MacCutchan29-Jun-13 0:58 
GeneralRe: Parse CSV using RegularExpression Pin
OriginalGriff29-Jun-13 1:46
mveOriginalGriff29-Jun-13 1:46 
GeneralRe: Parse CSV using RegularExpression Pin
Richard MacCutchan29-Jun-13 5:14
mveRichard MacCutchan29-Jun-13 5:14 
GeneralRe: Parse CSV using RegularExpression Pin
OriginalGriff29-Jun-13 5:40
mveOriginalGriff29-Jun-13 5:40 
AnswerRe: Parse CSV using RegularExpression Pin
OriginalGriff29-Jun-13 1:44
mveOriginalGriff29-Jun-13 1:44 
GeneralRe: Parse CSV using RegularExpression Pin
haha_c30-Jun-13 15:30
haha_c30-Jun-13 15:30 
GeneralRe: Parse CSV using RegularExpression Pin
OriginalGriff30-Jun-13 22:18
mveOriginalGriff30-Jun-13 22:18 
AnswerRe: Parse CSV using RegularExpression Pin
Mycroft Holmes30-Jun-13 22:09
professionalMycroft Holmes30-Jun-13 22:09 
Questiontransforming a MemoryStream instance into a string Pin
BillWoodruff28-Jun-13 22:27
professionalBillWoodruff28-Jun-13 22:27 
AnswerRe: transforming a MemoryStream instance into a string Pin
OriginalGriff28-Jun-13 22:36
mveOriginalGriff28-Jun-13 22:36 
GeneralRe: transforming a MemoryStream instance into a string Pin
BillWoodruff29-Jun-13 5:49
professionalBillWoodruff29-Jun-13 5:49 
GeneralRe: transforming a MemoryStream instance into a string Pin
OriginalGriff29-Jun-13 5:58
mveOriginalGriff29-Jun-13 5:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.