Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Custom Library component best practiceCustom Library component best practice
Previous
 
Next
New Post
5/25/2008 4:15 AM
 

I want to change the functionality of a library component property (UserInfo.Email) to do what I want (return a preset email address for testing).

I am simply modifying the component directly and recompiling for now, but is there a better way I should be approaching this?

 
New Post
5/27/2008 10:53 PM
 

You should really try to avoid making any changes to the DNN core framework if you want to maintain future compatibility.

Having said that - given what you seem to be doing - there is probably not any other quick way to achieve what you need for testing purposes.

If however you wanted a longterm change to the functionaly of say the email property - you would most likely need to look at creating
a custom membership provider in the case of the email property or profile provider for other profile properties -
instead of changing the core code.

Westa

 
New Post
5/28/2008 11:08 AM
 

Rather than changing the core code for your example, I would simply offload the existing e-mail addresses to a temporary table and update the users table to have the default address.


-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
New Post
6/2/2008 3:54 AM
 

@Wes - Thanks for the thoughts. It seems that Mail.vb is used directly by a dozen or more .ascx files as well as inside modules and membership providers. Maybe commercial modules will use it too. This means a custom membership provider may not help as there could be functionality that uses Mail.SendMail that needs to be tested elsewhere . The custom membership provider would need to know that the email address was being requested for use in an email rather than for any other purpose (user details form form example).

If the asp.net class SmtpClient had a SendStarted event as well as a SendCompleted event, then it might be simple. Until then, I could always add this event in a wrapper class (two send methods each with two signatures would need to have the SendStarted event fired) around SmtpClient then use the wrapper in Mail.vb. Then an httpModule could sort out the test address.Still core changes though as I can't directly inject the wrapped class into Mail. Besides, It gets complex here as MailMessage.To is read only.

Maybe the core team could be persuaded to add (in 4.8.04?)  a SendPreparationStarted event in Mail.SendMail to allow for changes like this and others? I imagine a future release will have dependency injection, but that is probably a long way off.

So for now, if I need to change Mail.vb anyway, then I can simply add the 3 lines of code needed to test for a cookie (with Test Address) then change the MailTo local variable accordingly. This is what I have done currently to get the functionality.

 

 
New Post
6/2/2008 3:59 AM
 

@Mitch - Thanks for the sugestion. That would work fine on a dev site which only uses the local database. Most of my clients will need email verification via a remote database, as well as login by email address , so the email needs to be accurate (and unique) for that to work. Thus  I am unsure if this approach would be practical in my case. I am hoping to get a procedure worked out that can be used at any time when new functionality is added or changed on the site. Automated testing of this functionality is also something I want to achieve.

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Custom Library component best practiceCustom Library component best practice


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out