User Impersonation in .NET

May 14th, 2013

To complete some testing of a Windows-authentication-enabled WCF service from a non-Windows auth application today, I found that I needed to employ some account impersonation. There’s no built-in way in the .NET framework to impersonate a specific user, so I whipped up a class that can do it using P/Invoke functions. It’s crazy-easy to use:

try
{
using (new ImpersonateUser("username", "password", "domain"))
{
      // anything you do in here will be executed as the above user, e.g:
 
      using (var proxy = new ServiceProxyHelper(true))
      {
            // passing "true" in the constructor above will enable
// impersonation of the network channel inside your service
            // and allow you to call methods on a service as the above user
      }
}
}

This would be helpful in situations where we want Windows authentication on services but don’t require it for the apps subscribing to it

Email This Post Email This Post

Oh the ways you can set selected on a dropdownlist!

February 9th, 2010

I recently ran into this problem that seemed really odd. This is the .net world and I am using an item template. On itemdatabound I set a drop downlist’s selected item like this:

somedropdownlist.Items.FindByText("someText").Selected = True

I thought this should have worked. It did not. When the control was rendered the item I choose was not selected. So I thought that this could be a life-cycle thing. I tried:

somedropdownlist.SelectedValue = "Some Value"

that worked. Why? I don’t get it.

Email This Post Email This Post

MilwauCHI: “Multiple Facets of Accessible Design” Event

January 5th, 2010

Any one in the Milwaukee area who is remotely interested in web design should check out the event put on by MilwauCHI. MilwauCHI is the Milwaukee, Wisconsin chapter for the Association for Computing Machinery (AMC) Special Interest Group (SIG) on Computer-Human Interaction (CHI).

Titled “Multiple Facets of Accessible Design” this event will tackle accessible design on the web and else where. IndependenceFirst which is hosting the event is also in the process of revamping their website. Like their building, IndependenceFirst wants the new website to be a model for accessibility. I am really looking forward to this event.

Email This Post Email This Post

Paralles 5

November 10th, 2009

A few days ago I “upgraded” to Parallels 5. I have multiple XP environments and one of them refused to start and was giving me the blue screen of death. Here is my mistake: I tried to resolve the issues appearing on the blue screen. If this happens to you don’t try to solve these issues. It iwll get you no where very slowly. I did find this post though: http://reviews.cnet.com/8301-13727_7-10392166-263.html. It it turns out this is a known issue and easily be remedied. That is too late for me know, since I tried a repair on my vm which means might as well rebuild it now, hopefully though it is not late for you.

Email This Post Email This Post

Captcha 508 Compliance

October 13th, 2009

Recently when I was creating a contact us web page, I ran into an issue with 508 compliance. Generally, to make a site 508 compliant you have to sacrifice certain functionality to achieve this goal. However there is one area where this functionality cannot be sacrificed and this is in the use of a Captcha. Captchas are absolutely necessary when creating a website that allows user to submit comments, questions, or payments.  However in general captcha’s are very difficult to read even if you have 20/20 vision, are sometimes impossible to read for the color blind, and are obviously impossible for the blind using readers to understand. .

Read the rest of this entry »

Email This Post Email This Post

College Recruiting

October 13th, 2009

I always look forward to going to the various campuses around the area for recruiting. We usually visit UW Madison, UW Milwaukee, UW Whitewater and Marquette University. Generally, we have a good student and employer turnout on these campuses. I was expecting to see a lot more students looking for a position given the economy. It felt like both on the employer and student sides the attendance was very thin. Generally, Fall career fairs are not as well attended as the once in winter because there is fewer December than May graduates. So I am comparing this October to last October. If the labor market is not tight and companies are not hiring then where are the students and why are they not aggressively looking? Do you know?!

Email This Post Email This Post

Taking notes

October 2nd, 2009

It is always surprising to me that almost everyone I bring to the office for an interview never takes notes.  Here are some thoughts on note taking.  First the motivation for note taking in a meeting followed by some tips.

Six Good Reasons Why to Take Notes in Meetings:

  1. Improves listening skills:  When a person is taking notes (s)he is actively listening and trying to recognize main points and important things to record. Read the rest of this entry »

Email This Post Email This Post

Techies! We need your soft skills please.

September 28th, 2009

As I have been pulling together material for our seminar in a couple weeks (http://www.consult-cts.com/events), I can’t help but feel more and more excited about this.  I am working on compiling actual tools for people to walk away with and start implementing:  active listening worksheets, tips/reminders before a meeting, post-meeting tools, instructions for good note-taking, etc..  If you have any thoughts, shoot me a comment or email please!

I also thought I would share a giggle for this was part of my “inspiration” . . . http://www.youtube.com/watch?v=5TzHbcXYwI4 and an example of how everyone can relate to the office geek persona.

Email This Post Email This Post

Multi-Language E-Commerce

August 26th, 2009

The power of the Internet is its ability to reach across mountains and oceans into the heart of remote towns and villages. This is even more emphasized by the popularity and availability of mobile phones and other devices that are Internet enabled. A business through its on-line presence will have the world as its market by the flip of the switch. The only barrier becomes that of communication rather than distance and physical limitations. An e-commerce site entering a new market will now have to communicate its value proposition, the quality of its products, support information and specifications and many other communication pieces that have to be delivered in the language of the potential buyer. This is, of course, in addition to the basic e-commerce fundamental requirement of currency conversion and fulfillment issues.
Read the rest of this entry »

Email This Post Email This Post

Solving ASP.NET Compiler Issues with Unrecognized VB.NET 3.5 Feature Syntax

August 19th, 2009

The Issue

I recently encountered an issue with an ASP.NET 3.5 solution after converting it from ASP.NET 2.0.  The issue I’m going to be describing only pertains to the older web site projects (and only web projects — class libraries, etc. do not have this problem) as opposed to the newer web application projects.  I believe this to be true because the conversion wizard built into Visual Studio has rarely ever had trouble converting web application projects, while I’ve never successfully been able to automatically convert a web site project. Read the rest of this entry »

Email This Post Email This Post