derby leeds blog

Archive for the ‘ASP.NET / C#’ Category

I had to work in a project where I had to impersonate to access every call to the database using a given windows user account. It was a sharepoint 2010 project using forms authentication to login into the system. After login, whenever there is a db call from the code, I need to use windows impersonation. Luckily I got the code from the below link.

http://support.microsoft.com/kb/306158

Hope it helps others.

Thanks

HtmlTextWriterTag enumeration allows the output stream to write HTML mark up, along with HTML server controls, in response to a Web request. For example, in the following example demonstrates the use of the HtmlTextWriterTag enumeration. The Img field is used during rendering of an HtmlTextWriter named writer.

// Control the encoding of attributes.
// Simple known values do not need encoding.
writer.AddAttribute(HtmlTextWriterAttribute.Alt, “Encoding, \”Required\””, true);
writer.AddAttribute(“myattribute”, “No "encoding " required”, false);
writer.RenderBeginTag(HtmlTextWriterTag.Img);
writer.RenderEndTag();
writer.WriteLine();

For more details, please visit http://msdn.microsoft.com/en-us/library/system.web.ui.htmltextwritertag.aspx