Geeks With Blogs
Mayank Sharma ASP.NET
Send Multiple InMemory Attachments Using FileUpload Controls
I wanted to give users an ability to send multiple attachments from the web application. I did not want anything fancy, just a few FileUpload controls on the page and then send the email. So I dropped five FileUpload controls on the web page and created a function to send email with multiple attachments. Here’s the code: public static void SendMail(string fromAddress, string toAddress, string subject, string body, HttpFileCollection fileCollection) { // CREATE THE MailMessage OBJECT MailMessage mail ......

Posted On Wednesday, February 9, 2011 10:16 AM

Procedure or function has too many arguments specified
This error took me a while to figure out. I was using SqlDataSource with stored procedures for SELECT and UPDATE commands. The SELECT worked fine. Then I added UPDATE command and while trying to update, I would get this error: "Procedure of function has too many arguments specified" Apparently, good guys at .NET decided it is necessary to send SELECT parameters with the UPDATE command as well. So when I was sending the required parameters to the UPDATE sp, in reality, it was also getting my SELECT ......

Posted On Friday, May 7, 2010 9:35 AM

ASP.NET WebForm Page Life Cycle Events
Joe shared a nice list of page life cycle events, very useful when you are trying to figure out where to put what. Link: http://misfitgeek.com/blog/... ......

Posted On Friday, January 22, 2010 8:50 AM

Auto-Start in .NET 4.0
Here Scott talks about the new feature Auto-Start included in .NET 4.0 and IIS 7. This can prove really helpful in avoiding the initial delay experienced by the first visitor of a web ASP.NET application. Here's the post ......

Posted On Tuesday, September 22, 2009 7:25 AM

Windows Authentication using Forms Authentication

Here's a good article for doing Windows Authentication using Forms Authentication.

Windows Authentication using Form Authentication

Posted On Wednesday, August 19, 2009 3:58 PM

asp:Menu rendering problems in IE8, Safari and Chrome
I was caught off-gaurd today when a user of one my applications reported that the asp:Menu was not rendering properly in her IE browser. I checked the version and it was IE8. I changed the application to compatibility view and the menu rendered just fine. Since I cannot tell each and every user to view the app in compatibility view when in IE8, i started digging for solutions. It looked like a z-index problem to start with. The problem was that since the new IE8 is moving closer to standards, the ......

Posted On Wednesday, July 8, 2009 9:00 AM

Disable CSS Friendly Adapters
There are two ways to disable the CSS Friendly Adapters in ASP.NET: 1. In the Browser file Adapters for a specific control type can be disabled by just commenting out (deleting) the type of control adapter in the browser file. The effect is global and will affect all the controls of this type. For examle, to disable the adapter for GridView type: <!--<adapter controlType="System.Web.UI.... adapterType="CSSFriendly.Gr... />--> 2. At the control level Adapter ......

Posted On Wednesday, May 27, 2009 1:12 AM

Return SqlDataReader from a method
.NET's SqlDataReader class is based on an active connection to the database. This means that while the SqlDataReader is in use, the SqlConnection that is serving the SqlDataReader is open and cannot be used anywhere else. That is why, returning an SqlDataReader from a method is not stright forward like returning a DataTable or a DataSet. To read more about SqlDataReader, please see SqlDataReader class. Though it is not straight forward, it is very simple. Here's a piece of code that would let you ......

Posted On Tuesday, May 26, 2009 1:58 AM

Compress Image files using C#
Found a nice post by Mr.Polite for compressing JPEG images. Here's the link: http://www.vbforums.com/sho... Posting the code here for my reference in case the original post gets deleted or changed. Image myImage = //... load the image somehow // Save the image with a quality of 50% SaveJpeg (destImagePath, myImage, 50); //add this! using System.Drawing.Imaging; /// <summary> /// Saves an image as a jpeg image, with the given quality /// </summary> /// <param name="path">Path ......

Posted On Wednesday, April 29, 2009 8:15 AM

Hyperlink to Windows Remote Desktop (RDP) session using ASP.NET
Hyperlink to Remote Desktop (RDP) session: I had some IP addresses on a web page which would be used internally by our company users and wanted to display them as hyperlinks. When a user clicks an IP address, a Windows RDP session should start. The simplest way I could think of was to transfer an RDP file to the client, which she can open or save via regular HTTP File Transfer. An RDP file can be edited by a simple text editor. If you open an RDP file with notepad, you will see all the settings. ......

Posted On Tuesday, March 17, 2009 1:54 AM

Copyright © bullpit | Powered by: GeeksWithBlogs.net