More cool email stuff - .Net forms authentication

While killing time, I built a web app for our practice area at work. I especially enjoyed using forms authentication, and got to work with the really nice built-in login controls in .Net, including the ASPNETDB. (Geezsh Microsoft seems as if they're bombarding us with these databases- ASPNETDB, ASPSTATE, ASPNETFORUMS, etc.. Why don't they just include them as "system" databases from the gitgo in SQL 2005/08?). Anyway, the forms controls are really neat, and the database is very extensive. A couple of blogs ago I mentioned the greatness of Google! for sending blind email. Got a ton of responses, mostly negative. Complaints notwithstanding, I wanted to use the same logic for my PasswordRecovery page for my web app. The problem that I ran into was that the OnSendingMail doesn't allow you to specify the value for SSL, which happens to be required for Google! However, the method can be overridden. Niiiiiiiice! 

Originally I created a simple function in code-behind; however, even a DBA knows that you don't use code behind like this. So, I built the following class for the override so you can call it from PasswordRecovery.aspx.cs, or wherever else. And it works great! Also not shown is some code in the <appSettings> portion of the web.config file; I simply added a couple of key-value pairs for mail. Hope that you can use this when working with the excellent forms authentication controls.

 


---------------------

I'll drink to this! And just about anything else, really.



Click here to get the code....


Comments

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading




by Lee Everest, M.S.

Search


Ads

Calendar

«  July 2010  »
MoTuWeThFrSaSu
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678
View posts in large calendar

Tags

Disclaimer
The opinions, code, examples, et.al. expressed herein are my own personal opinions and do not represent my employer's view in any way, shape form, or fashion.  All code for demonstration purposes - no guarantees, either written or implied, are made.

© Copyright 2010 Lee Everest's SQL Server, etc. weblog