Join Dotnetcodes DotnetCodes.com is online Discussion Forum for Software professionals . It lets you find friends around the world and Create professional network that share similar interests as you. Get help on ur projects by industry specialists. Also get answers to all ur technical/placement related querries.Get an edge over others.
Already MemberClick here to login
ASP.net MVC Interview Questions Answers Interview Questions
Get Started Developing for Android Apps with Eclipse Articles
Serial Number in SSRS Articles
.Net framework 4.0 Interview Questions Answers Interview Questions
SQL server reporting services Interview Questions (SSRS) part 1 Articles
Whats New in ASP.NET 4.0 Part 2 Articles
How to Print a Crystal Report direct to printer Articles
Difference between Encapsulation and Abstraction Interview Questions
Explaining SDLC -System Development Life Cycle Articles
Html5 interview questions and answers Interview Questions
SharePoint 2010 interview Questions Answers Interview Questions
Infosys Interview Questions Interview Questions
Dynamic Menu using HTML List Tag and CSS in ASP.Net Articles
Populate or bind Dropdownlist in Asp.net using Jquery and Json Articles
ASP.NET MVC Overview Interview Questions
Submit Articles | More Articles..

User Impersonation Problem

Posted By: sumith1andonly on 6/30/2011 12:00:41 AM | Comments:1 [Forward This]
hi guyz, i tried to get performance counters details from system in a network. this project is on web(ASP.NET ), Currently on local host. To get the conters details , i created a dll in vc++ . I call Code to Imersonte User .After Getting Counters data, i Called REVERTOSELF to end impersonation. To Imersonate User : I called the following Functions : 1.LogonUser : to logon as New user 2.DuplicateTokenEx : Duplicate The token with security features . 3.ImpersonateLoggedOnUser : To impersonate the user Then I cal PdhConnectMachine To get Connect with specifed User. Then I cal PdhEnumObjects 2 time . first to allocate mennory to hold the performance object second to get all Performance object list. then i cal ReverttoSelf to end impersonation. MY problem is that , the After the Revertself i get current user name by using GetUserName Api. i got different username (expected Username : SUMITH).ie , The user before impersonation : Sumith The user After impersonation : Admin when unimpersonate (calling reverttoself) the user : Local Service i used the CoInitializeSecurity () . But the Result is same? What i do some one give me a solution?

Dear Friends, Dont forget to bookmark and submit your posting to social websites listed above.It will bring more visibility, buzz and fast action to attend your post

Responses to the Discussion: User Impersonation Problem
Reply by: Jaishree on: 7/5/2011 6:32:27 AM
Hi, You can use CoInitializeSecurity function specifying the impersonate level as RPC_C_IMP_LEVEL_IMPERSONATE. Use can visit below link for your reference http://msdn.microsoft.com/en-us/library/ms693736%28v=vs.85%29.aspx
 
You have not Logged In,  click here to Login
Reply Here
 
, I agree the terms and conditions of this website
  
  .NET Framework
  ADO.NET
  AJAX
  Android
  ASP.NET
  ASP.NET AJAX
  ASP.NET MVC
  Azure
  Best Practices
  BizTalk Server
  C++
  CSharp
  CSS
  DBMS
  Error and Resolution
  HTML
  IIS
  JAVA
  JavaScript
  JQwery
  JSP
  LINQ
  Management
  Mobile
  ODP.NET
  OOPS
  Oracle
  Others
  Pattern and Practices
  PHP
  SAP
  SEO
  SharePoint
  Silverlight
  Sql Server
  SSAS
  SSIS
  SSRS
  Survey
  UML
  UNIX
  VB
  VB.NET
  VS 2010
  WCF
  Web Analytics
  Windows Forms
  WPF
  WWF
  XML
  XSLT
  .NET Framework
  ADO.NET
  AJAX
  Android
  ASP.NET
  ASP.NET AJAX
  ASP.NET MVC
  Azure
  Best Practices
  BizTalk Server
  C++
  CSharp
  CSS
  DBMS
  Error and Resolution
  HTML
  IIS
  JAVA
  JavaScript
  JQwery
  JSP
  LINQ
  Management
  Mobile
  ODP.NET
  OOPS
  Oracle
  Others
  Pattern and Practices
  PHP
  SAP
  SEO
  SharePoint
  Silverlight
  Sql Server
  SSAS
  SSIS
  SSRS
  Survey
  UML
  UNIX
  VB
  VB.NET
  VS 2010
  WCF
  Web Analytics
  Windows Forms
  WPF
  WWF
  XML
  XSLT
All rights reserved to dotnetcodes. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks.
Best viewed at 1024 x 768 resolution with Internet Explorer 5.0 or Mozila Firefox 3.5 or Google Crome and higher