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....


blog comments powered by Disqus

by Lee Everest, M.S.

Poll

Do you use Azure or cloud in your organization?



Show Results

Ads

Search


Month List

Calendar

«  February 2012  »
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011
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 2012 Lee Everest's SQL Server, etc. weblog