Adnan’s Blog

Archive for September 2008

Heres a quick tip. If you need to include a request for read receipt like Microsoft Outlook while sending mails through Asp.net, just add the Disposition-Notification-To Header to the MailMessage.

The MailMessage class does not have a corresponding attribute and thus it has to be set through the Header.

MailMessage mm = new MailMessage(fromAddress, toAddress);
mm.Subject = subject;
mm.Headers.Add("Disposition-Notification-To", sendReadReceiptToAddress);

Please keep in mind that this is only a request, and can be rejected/ignored by the Mail Client/User configuration.

Advertisements

In my current project I needed to access the Session state in a Generic Handler. To my dismay, i realized that the Session StateBag was null. The StateBag class is sealed and manages the Viewstate of the Asp.net server controls and pages.

Upon discussion with my colleague, Mr. Hamed, we found the solution to my problem. Using the IRequiresSessionState interface in System.Web.SessionState, we got access to Session state.

According to Microsoft “Specifies that the target HTTP handler requires read and write access to session-state values. This is a marker interface and has no methods.

Another option was to use the IReadOnlySessionState interface (Specifies that the target HTTP handler requires only read access to session-state values. This is a marker interface and has no methods.)

Needless to say, there is a performance increase in the latter case and if your requirement is only to read Session state, then that would be the right choice

Recently, I felt the need for removing a project from the Visual Studio Start Page, so I Googled and would like to share the solution. Don’t forget to close visual studio before trying this out. This trick requires modification to registry, so if you are skeptical do make a backup of the registry before proceeding.

Start the registry :

Start > Run > regedit > HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\ProjectMRUList

Then delete the key that has the project you want to remove.

Visual Studio > 9.0 > ProjectMRUList

Visual Studio > 9.0 > ProjectMRUList

Note:

  • The Project Keys are consecutive. So if you have 5 projects listed, and you delete the key for the 4th project ie File4, the 5th project (File5) will also not be shown. You will need to remain one of the keys so that the list remains consecutive.
  • The same procedure can be repeated for the FileList and Find sections of the registry

Being a Web Developer, I don’t know whether to rejoice the addition of another browser or not? With all the hype of IE 8 ; Cross-Browser compatibility and now this, life sure is chaotic.

I am not going to blog about the new features of Google Chrome (We already have tons of them). It’s been analyzed that Chrome has been optimized for Google Applications and Services. Is that a bad thing??? Frankly, i don’t think so, cos admit it or not, every netizen is dependent on them. But i do welcome the Process-Thread architecture in Chrome, cos i had the same problem in both IE and Firefox.

We can all expect great things from Google, lets hope its the same with Chrome. Good luck to the development and Congrats on the Beta release.

7 really awesome things about Google Chrome : http://mashable.com/2008/09/03/awesome-google-chrome/

Google Chrome Introduction (Comic Book) : http://www.google.com/googlebooks/chrome/index.html

Tags: