Friday 21 January 2011

Send generated excel on the web using HTTPReponse in dot.net

Problem:
You want to send a generated excel file as web response to the client.


Wednesday 19 January 2011

Execute a generic query on sql server.

Question:
Execute a generic query string on sql server.


Monday 17 January 2011

How to implement impersonation in an ASP.NET application

Question:
You want to impersonate the authenticating user only when you run a particular section of code.

Answer:
You must import [COM] advapi32.dll and use platform specific code.

Here is the microsoft article that describes different ways to implement impersonation in an ASP.NET application with sample code.

Impersonation in an ASP.NET application
Wednesday 12 January 2011

HTML: Entities or characters to encode in Html

Question:
What characters browsers do not like?
Do you have a list of entity code for common characters?

Monday 3 January 2011

Dump object state to string

Question:
I want to dump the members and properties of an object to the log to see the objects state.


Saturday 1 January 2011

Get dictionary of properties of a Type in CSharp

Question:
How do I get all public properties of a given type as a Dictionary?
How do I get properties of an object?
Get list of ProperyInfo for a given type.