Click here to Skip to main content
15,867,568 members
Home / Discussions / C#
   

C#

 
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
subeditorPete 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 
AnswerRe: Running code as different user Pin
Eddy Vluggen12-Dec-12 3:31
professionalEddy Vluggen12-Dec-12 3:31 
QuestionHTML TO XML Convertion using C# Pin
chittu dinesh11-Dec-12 20:29
chittu dinesh11-Dec-12 20:29 
AnswerRe: HTML TO XML Convertion using C# Pin
Pete O'Hanlon11-Dec-12 20:41
subeditorPete O'Hanlon11-Dec-12 20:41 
GeneralRe: HTML TO XML Convertion using C# Pin
chittu dinesh11-Dec-12 22:41
chittu dinesh11-Dec-12 22:41 
AnswerRe: HTML TO XML Convertion using C# Pin
BobJanova12-Dec-12 4:25
BobJanova12-Dec-12 4:25 
QuestionFor Developinf Login Application for windows Pin
Member 913168411-Dec-12 20:02
Member 913168411-Dec-12 20:02 
AnswerRe: For Developinf Login Application for windows Pin
Pete O'Hanlon11-Dec-12 20:54
subeditorPete O'Hanlon11-Dec-12 20:54 
AnswerRe: For Developinf Login Application for windows Pin
Richard Deeming12-Dec-12 1:48
mveRichard Deeming12-Dec-12 1:48 
Questionstoring image in isolated storage Pin
singh123456711-Dec-12 18:39
singh123456711-Dec-12 18:39 
QuestionHow to print an SSRS Report in PDF Format from my asp.net page Pin
Vinay Meka11-Dec-12 18:04
Vinay Meka11-Dec-12 18:04 
AnswerRe: How to print an SSRS Report in PDF Format from my asp.net page Pin
Richard Deeming12-Dec-12 1:42
mveRichard Deeming12-Dec-12 1:42 
Questionadd labels to an image at different zoom levels Pin
vr99999999911-Dec-12 18:03
vr99999999911-Dec-12 18:03 
AnswerRe: add labels to an image at different zoom levels Pin
Pete O'Hanlon11-Dec-12 20:17
subeditorPete O'Hanlon11-Dec-12 20:17 
GeneralRe: add labels to an image at different zoom levels Pin
vr99999999911-Dec-12 20:28
vr99999999911-Dec-12 20:28 
GeneralRe: add labels to an image at different zoom levels Pin
Pete O'Hanlon11-Dec-12 20:34
subeditorPete O'Hanlon11-Dec-12 20:34 
GeneralRe: add labels to an image at different zoom levels Pin
vr99999999911-Dec-12 20:41
vr99999999911-Dec-12 20:41 

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.