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.
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
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
If you have a problem using the code in an article, it's usually best to post the question to the message board at the end of the article[^], since the author of the article is the best person to help you.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
From your code that's posted with the question on the article;
string profile = dirEntr.Properties["profilePath"].ToString(); //terug komende nullreference,
// lokaal geen probleem op server wel
dirEntr.Close();// this part returns catastrophic failure
If the first line throws an exception, it'd be logical for the second line to fail. The first line contains multiple statements, which I'd prefer to see split over several lines (to accommodate debugging), like this;
object profilePath = dirEntr.Properties["profilePath"];
string profile = Convert.ToString(profilePath); // geen nullreference meer
// al kan de string nog steeds leeg zijn.
It might be that the property "ProfilePath" doesn't return a value; you'd put a breakpoint there and step through it. As a sidenote, you did see the warning in the article?
Please note: The user context that initiates the impersonation (i.e. not the user context to which it is switched to) needs to have the "Act as part of operating system" privilege set.
If it's valid XHTML, then it's already XML. If you mean translate it to a particular schema, you can do that with XSLT.
If it's typical Internet HTML, then it isn't valid XML, and you will have to construct some sort of state-based reader that makes reasonable guesses about what non-XML markup actually means (i.e. unclosed <li>s and <p>s, unmatched chevrons, tags with naked attributes, etc).
Any one can help me,and tell that how i create a windows login application,and run this login application when computer start like windows logon screen,,and i want to replace this windows logon application with my own,,plz help