Tuesday, 23 August 2011

Asp.Net: Write Binary Stream to Response

Question:
How to send a Pdf binary stream as response of a web request?
How to return a generated pdf to the user in an asp.net app?

Friday, 19 August 2011

Csharp: Regular Expressions Named Captures

Question:
How to use Named Capture Groups with C# Regular Expression class (Regex)?

Tuesday, 16 August 2011

VisualStudio: Cheat Sheet CSharp Code Snippets


Question:
What are the common c# code snippets in Visual Studio 2010.

Wednesday, 20 July 2011

SQL: Get random records from database

Question:
How to get a number of random records from a table.

Monday, 18 July 2011

Dot.Net: Register WebResource Javascript from Different Assembly

Question:
I have a web control project and a web project.
In the web control project I embed a javascript file and declared it as a WebResource in the AssemblyInfo.cs:
[assembly: System.Web.UI.WebResource("Namespace.Folder.MyScript.js", "text/javascript", PerformSubstitution = false)].

When I want to use it from the web project using:
this.Page.ClientScript.RegisterClientScriptResource(this.GetType(), "Namespace.Folder.MyScript.js");
It does not work.
Why is the javascript file not loaded into the page?

Dot.Net: Loading UserControl ascx Dynamically

Question:
How to load a UserControl (ascx) dynamically?

Dot.Net: Make Internal Methods and Properties visible to another DLL

Question:
How to make internals visible to another dll?
I want to render my internals visible to a test class. How do I do that?