473,503 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to convert WindowsIdentity.Token that is IntPtr type to string

Hello

How to convert value of WindowsIdentity.Token that is IntPtr type to string
type?

Thanks
Nov 17 '05 #1
4 8210
public static string PtrToStringAuto(IntPtr ptr)

string myString =
System.Runtime.InteropServices.Marshal.PtrToString Auto(myIntPtr);

http://msdn.microsoft.com/library/de...gautotopic.asp

http://msdn.microsoft.com/library/de...classtopic.asp

"MilanB" <Mi****@discussions.microsoft.com> wrote in message
news:D9**********************************@microsof t.com...
Hello

How to convert value of WindowsIdentity.Token that is IntPtr type to string type?

Thanks

Nov 17 '05 #2
I tried out.
But I recieved "null" as returned value to string.
string myString =
System.Runtime.InteropServices.Marshal.PtrToString Auto(myIntPtr);

After this line, myString is null.

WindowsIdentity.Token is correct value, but returned string is null.

Thanks
"Lebesgue" wrote:
public static string PtrToStringAuto(IntPtr ptr)

string myString =
System.Runtime.InteropServices.Marshal.PtrToString Auto(myIntPtr);

Nov 17 '05 #3

"MilanB" <Mi****@discussions.microsoft.com> wrote in message
news:D9**********************************@microsof t.com...
Hello

How to convert value of WindowsIdentity.Token that is IntPtr type to
string
type?

Thanks


Why would you do this? The IntPtr is NOT pointing to a string, actualy it
points to nothing it is a HANDLE.

Willy.
Nov 17 '05 #4
Thanks Willy

Someone wanted from me to convert this pointer to string. I suposed that it
can not be done, but was not sure 100%.

Thanks again
Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1372
by: Robert Phillips | last post by:
I periodically get an ApplicationException "access is denied" in the WindowsIdentity._GetCurrentToken() method. Reflector shows the _GetCurrentToken() method as private static extern IntPtr...
8
32986
by: BLiTZWiNG | last post by:
After playing with the code shown and utilising Willy Denyottes' help, I have come to the conclusion that there is some form of difference between the managed WindowsIdentity.Impersonate() over the...
8
12129
by: ppcdev | last post by:
Here's what I try : LPCTSTR tst = (LPCTSTR) (LPCWSTR) Marshal::StringToHGlobalUni(str); c:\MyNetPrj\Prj0001\stunt.cpp(244): error C2440: 'type cast' : cannot convert from 'System::IntPtr' to...
3
4274
by: Kevin Burton | last post by:
This is more of a solution that raised a question. I have a Web service that does not allow anonymous users. For debugging I put in the following lines in my Web Service: WindowsIdentity wi =...
8
9430
by: Razak | last post by:
Hi, I have a class which basically do Impersonation in my web application. From MS KB sample:- ++++++++++++++++++++code starts Dim impersonationContext As...
13
12932
by: ALI-R | last post by:
I know how to authenticate to a webservice using either of these ways(Assuming that rService represents the webservice): 1) rService.Credentials = new...
4
4465
by: Roger Aikin | last post by:
I've converted a VB6 project to VB.Net 2005. (Actually using vstudio pro 2005). I'm on a machine that also has VB6 and Vstudio.net 2003 on it. The project uses Word, Excel, MapPoint and SqlClient...
2
1777
by: Eric Pearson | last post by:
I create a user token for the windows anonymous user ("NT AUTHORITY\ANONYMOUS LOGON") using ImpersonateAnonymousToken. I successfully create a WindowsIdentity from that token, but the Groups...
8
5892
by: Serge BRIC | last post by:
My application, written in .NET VB, tries to get a communication port handle from a TAPI object with this code: Dim vFileHandle As Byte() = appel.GetIDAsVariant("comm/datamodem") The...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7006
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7467
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5021
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3166
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1519
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
397
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.