Click here to Skip to main content
15,896,269 members
Home / Discussions / C#
   

C#

 
AnswerRe: problem with using pointers in C# Pin
Abhinav S12-Dec-12 5:04
Abhinav S12-Dec-12 5:04 
AnswerRe: problem with using pointers in C# Pin
OriginalGriff12-Dec-12 5:06
mveOriginalGriff12-Dec-12 5:06 
AnswerRe: problem with using pointers in C# Pin
DaveyM6912-Dec-12 8:08
professionalDaveyM6912-Dec-12 8:08 
AnswerRe: problem with using pointers in C# Pin
trønderen12-Dec-12 10:57
trønderen12-Dec-12 10:57 
QuestionValue of label is not changing upon loading or changing the value of the combobox Pin
jon-8012-Dec-12 4:37
professionaljon-8012-Dec-12 4:37 
AnswerRe: Value of label is not changing upon loading or changing the value of the combobox Pin
Eddy Vluggen12-Dec-12 4:42
professionalEddy Vluggen12-Dec-12 4:42 
AnswerRe: Value of label is not changing upon loading or changing the value of the combobox Pin
Freak3012-Dec-12 4:52
Freak3012-Dec-12 4:52 
QuestionApply diff image on the original image c# Pin
Tridip Bhattacharjee12-Dec-12 0:22
professionalTridip Bhattacharjee12-Dec-12 0:22 
QuestionTwo image compare using win32 api c# Pin
Tridip Bhattacharjee12-Dec-12 0:21
professionalTridip Bhattacharjee12-Dec-12 0:21 
AnswerRe: Two image compare using win32 api c# Pin
Pete O'Hanlon12-Dec-12 1:01
mvePete O'Hanlon12-Dec-12 1:01 
QuestionCode does not appear to be called when program is run Pin
bikerben12-Dec-12 0:07
bikerben12-Dec-12 0:07 
AnswerRe: Code does not appear to be called when program is run Pin
Pete O'Hanlon12-Dec-12 1:06
mvePete O'Hanlon12-Dec-12 1:06 
GeneralRe: Code does not appear to be called when program is run Pin
bikerben12-Dec-12 1:23
bikerben12-Dec-12 1:23 
GeneralRe: Code does not appear to be called when program is run Pin
Pete O'Hanlon12-Dec-12 2:25
mvePete O'Hanlon12-Dec-12 2:25 
SuggestionRe: Code does not appear to be called when program is run Pin
Richard MacCutchan12-Dec-12 3:07
mveRichard MacCutchan12-Dec-12 3:07 
GeneralRe: Code does not appear to be called when program is run Pin
bikerben12-Dec-12 3:12
bikerben12-Dec-12 3:12 
GeneralRe: Code does not appear to be called when program is run Pin
Alan N12-Dec-12 3:07
Alan N12-Dec-12 3:07 
QuestionTFS and WIX Pin
Pascal Ganaye11-Dec-12 22:33
Pascal Ganaye11-Dec-12 22:33 
QuestionCanny edge detection in c# Pin
neha198711-Dec-12 22:11
neha198711-Dec-12 22:11 
AnswerRe: Canny edge detection in c# Pin
Simon_Whale11-Dec-12 22:23
Simon_Whale11-Dec-12 22:23 
AnswerRe: Canny edge detection in c# Pin
Pete O'Hanlon11-Dec-12 22:34
mvePete O'Hanlon11-Dec-12 22:34 
QuestionWCF Services in a multi threaded application results in Oracle Connection request Timed out error Pin
rajaron11-Dec-12 21:56
rajaron11-Dec-12 21:56 
AnswerRe: WCF Services in a multi threaded application results in Oracle Connection request Timed out error Pin
Eddy Vluggen12-Dec-12 3:05
professionalEddy Vluggen12-Dec-12 3:05 
GeneralRunning code as different user Pin
MacUseless11-Dec-12 21:35
MacUseless11-Dec-12 21:35 
Hello,

I'm working on a small project wich requires me to run some code as a different users , (not the windows users)
I.e. user starts the program and he/she is required to login first, then there allowed to run a piece of code.

My login code looks like this :
C#
//user authenticate
private bool Authenticate(string userName, string password, string domain = null)
{
    bool authentic = false;
    try
    {
        using (PrincipalContext context = new PrincipalContext(ContextType.Domain))
        {
            authentic = context.ValidateCredentials(userName, password);
        }
    }
    catch (DirectoryServicesCOMException) { }
    return authentic;
}

Wich works,
But i cannot execute the rest of my code.
I've tried to use Impersonation Class but it results in an "Catasthropic failure"
The code blow is how i use the impersonation,
it happends after a button_click event
C#
using (new Impersonator(txtGebruiker.Text, txtDomein.Text, txtPw.Text))
{
    string profile = GetProfilePath(txtProfiel.Text);
    txtLog.Text = profile;
}


I think im using the impersonation wrong ,
Any tips or suggestions are welcome Smile | :)

Thanks in advance
SuggestionRe: Running code as different user Pin
Richard Deeming12-Dec-12 1:51
mveRichard Deeming12-Dec-12 1:51 

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.