I used the common impersonation code and it worked just fine, until I inserted random 'dggdgsdg' in domain - and it worked nonetheless...
if (LogonUser(Username, Domain, Password, Logon32LogonInteractive, Logon32ProviderDefault, ref existingTokenHandle) &&
DuplicateToken(existingTokenHandle, (int)SecurityImpersonationLevel.SecurityD...
A co-worker has inherited a Microsoft Access macro that executes a series of SQL operations against a Sybase database by calling OpenQuery on a bunch of action queries, which use linked tables over ODBC. I would like to help him convert it to an SQL script that we can execute directly against the database. And since we have quite a few m...
Is there any way in SharePoint 2010 to get the Distinct values of a property accross all users? For example, I want a list of all Departments in the Profile Store.
In SQL I can do
SELECT DISTINCT(PropertyVal) FROM [ProfileDB].[dbo].[UserProfileValue]
WHERE PropertyID = 14
but accessing the SQL Database is a big no-no of course, so I ...
What does this do exactly?
var counts = new Dictionary<string, int>();
for (int i = 0; i < 10; i++)
counts[string.Format("STA Thread Queue Worker Thread No. {0}", i + 1)] = 0;
Thanks
...
Hi everybody, I am making making a program and I want to have a Aero Glass set of controls just like Windows Media Player, I found this: http://blogs.msdn.com/b/tims/archive/2006/04/18/578637.aspx but it just draws black. I also found a control that had the media player controls built in right ton the glass but it was no good it didn't w...
What is the fastest way for a .Net program to index all images on a users' computer?
Using Open Source .Net Libs and native .Net classes.
In a way good for XP sp3 ,..., Windows 7
Fastest - Same pc configuration, different time (seconds)
.Net program - better C#
To index - get a list of absolute links (like c://bla-bla/file ) and sa...
We have message framing working by using a lengh prefix but using .NET 2.0 beginSend/BeginReceive.
Is message framing any different in 3.5, if so how should we implement it using the new framework?
Are there any useable examples out there which focus purely on message framing using 3.5?
Many thanks
...
I've read all the questions I can find regarding the issues of composing imports without exporting the containing class but I can't find a solution to my problem. Does anybody know a way to achieve what I'm trying to do?
My module assemblies have forms and classes which they use internally. These forms need access to some of the exporte...
I have got a .NET winform application that uses a Web Mapping Service that is password protected. Unfortunately I cannot attach a username and password to requests, ( the request are generated from a GIS mapcontrol)
I can think of two ways around it
Intercept all web requests from my .NET app and add a username/password
Set up an Apa...
The code below works great. If the Get and Use methods are in different assemblies, the code fails with a RuntimeBinderException. This is because the .Net runtime system only guarantees commonality of anonymous types (<string, int> in this case) within assemblies.
Is there any way to fool the runtime system to overcome this? I can expe...
I'm looking to develop a CMS project based on UMBRACO but I also need to index the documents created and to offer search functionality therefore I would like to know if you have any suggestion for a lightweight search engine available in .net technology. The main requirement is to be simple and efficient (nothing complex like solr or sp...
Hi,
Here's a test:
WeakReference ref1;
WeakReference ref2;
TestRepositoryEntitiesContainer context;
int i = 0;
using (context = GetContext<TestRepositoryEntitiesContainer>())
{
context.ObjectMaterialized += (o, s) => i++;
var item = context.SomeEntities.Where(e => e.SomePropertyToLookupOn == "some property").First();
conte...
I see that Seq has a cast function from IEnumerable to Seq, but how do I get it to work?
open System.Text.RegularExpressions;;
let v = Regex.Match("abcd", "(ab)");;
Seq.cast (v.Captures);;
This produces,
error FS0030: Value restriction. The value 'it' has been inferred to have generic type
val it : seq<'_a>
Either define 'it' as ...
In a system with both ends (client and server) in .NET, is it possible to use the binary serialization provided by the dataset class in ADO.NET 2.0 when the datasets are exposed as WebMethods parameters ?
Is it ok to use something like the following just before the dataset is returned:
someDataSet.RemotingFormat = SerializationFormat.B...
.NET contains its own equality comparison functionality, however I don't really understand how it works.
If the desired Equals() and == behaviour is to verify that every field of an object is equal to every field of another object, is it necessary to override Equals() with a method that does this explicitly?
...
I am trying to replace (or add in the case it doesn't exists) icons from .exe files using c#.
So far I got this:
string filename = "c:\\test.exe";
IntPtr hResource = BeginUpdateResource(filename, true);
if (hResource.ToInt32() == 0)
throw new Exception("File Not Found");
byte[] ico = System...
In a Tuple, if you have more than 7 items, you can provide an 8th item that is another tuple and define up to 7 items, and then another tuple as the 8th and on and on down the line. However, there is no constraint on the 8th item at compile time. For example, this is legal code for the compiler:
var tuple = new Tuple<int, int, int, int...
Is there any way in .NET for a thread to determine its 'parent', i.e. the thread that created it?
I'm diagnosing a timing issue with a black box third party API and would like to find out what custom code of mine it is executing on which thread.
...
I am able to successfully retrieve the wsdl from a server with the code below.
How can I now call a method (GetVersion) from this same service?
Trying http://www.servername.com/DataService.asmx/GetVersion returns an error saying the page cannot be found. I have no problem calling the method from a .Net WebService reference, but I'd li...
I love my Delphi 4 but at the same time I see the need to talk to windows .net
This is a recompiled dll that I found on sourceforge.net/projects/delphinet/ (DelphiNet03.zip) by some nice people that fund the dll from some were.
The real answer is to make this dll so that fits into Delphi as true Delphi code, and not a dll clip on. So ...