CKS Forms Based Authentication Solution - email not working

Jun 19, 2009 at 4:42 PM

Hello;

I have deployed the FBA solution to my Sharepoint site, however I am having an issue with the user not receiving an email after changing their membership status from pending to "Approved"

Has anyone else seen this issue for this specific solution?

Regards

 

Developer
Jun 24, 2009 at 12:22 AM

Is SMTP set up correctly?  There are many reasons why emails might not get sent...do alerts on that site work?

Regards,

Mike Sharp

Jul 1, 2009 at 3:26 PM

I am having the same issue, I checked hte logs and found this:

The remote server returned an error: (401) Unauthorized.    at System.Net.HttpWebRequest.GetResponse()     at System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials)     at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)     at System.Xml.Xsl.Xslt.XsltLoader.CreateReader(Uri uri, XmlResolver xmlResolver)     at System.Xml.Xsl.Xslt.XsltLoader.Load(Compiler compiler, Object stylesheet, XmlResolver xmlResolver)     at System.Xml.Xsl.Xslt.Compiler.Compile(Object stylesheet, XmlResolver xmlResolver, QilExpression& qil)     at System.Xml.Xsl.XslCompiledTransform.CompileXsltToQil(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)     at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, Xsl    464b54ee-b390-4559-9cea-f750ef4e5555

 

Looks like a permission issue but it doesn't make sense as this is being run as user with admin rights on the site settings. I changed the emails directory to allow everyone access and I am still getting this. Any ideas?

 

Jul 1, 2009 at 8:05 PM

Ok I found the issue, the base code assuems that your default site will be the public facing url (ie: www.somedomain.com), this is why the pending emaisl work. They approval/denial emails don't work because your probably using windows authentication - and when the notification goes to grab the xsl it is not presenting credentials on request. Here is the revised code that needs to be added:

                //CS - added network credentials to remove the 401 error
                XmlUrlResolver resolver = new XmlUrlResolver();

                resolver.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
                XmlReaderSettings settings = new XmlReaderSettings();
                settings.XmlResolver = resolver;
                XmlReader ReaderObj = XmlReader.Create(xsltTemplateFile, settings);

                //xslEmailTransform.Load(xsltTemplateFile);
                xslEmailTransform.Load(ReaderObj);

This goes in the email.cs file in the public static bool SendEmail(SPWeb web, string emailTo, string xsltTemplateFile, IDictionary xslValues) method. You can email me for the corrected WSP (csalvo@joppasoftware.com) if you don't write code.

Jul 8, 2009 at 6:52 PM

So in the case where I have a public facing url using Forms authentication and anonymous access turned on for the site, the original code in the email.cs file should work for sending the membership pending email ?

I have tried it without modifications and with the modifications mentioned above, and cannot get it to successfully send the membership pending email when an anonymous user navigates to the site and attempts to sign up for a account.

If I look in the ULS logs, I see an error message about not being able to connect to the remote server, any suggestions ?

Jul 8, 2009 at 7:02 PM

Check to make sure that your local machine can resolve the name of the url locally. Sounds like your using a fqdn that might resolve to another machine based on a firewall or DMZ. If you want to post the errors from ULS and your network topology I would be more than willing to help troubleshoot it.

Jul 8, 2009 at 8:04 PM

Thank you very much, that was the missing piece.

Jul 16, 2009 at 9:05 PM

Hello;

I have verified my SMTP was setup correctly and was able to get emails working for a bit. Now I am not receiving emails, again...I am noticing the following errors in my logs:

 

CKS.FormsBasedAuthentication, V (0x1CAC) 0x0D70 InternetExtranetEdition        System.Xml.Xsl.XslLoadException 0 Critical XSLT compile error.    at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include)     at System.Xml.Xsl.Xslt.XsltLoader.Load(Compiler compiler, Object stylesheet, XmlResolver xmlResolver)     at System.Xml.Xsl.Xslt.Compiler.Compile(Object stylesheet, XmlResolver xmlResolver, QilExpression& qil)     at System.Xml.Xsl.XslCompiledTransform.CompileXsltToQil(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)     at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)     at System.Xml.Xsl.XslCompiledTransform.Load(String stylesheetUri)     at CKS.FormsBasedAuthentication.Email.SendEmail(SPWeb web, String emailTo, String xsltTemplateFile, IDictionary xslValues)Inner Error: '0' i feb86180-045d-41aa-a80b-946c0fe36727

 


07/16/2009 15:46:27.10  CKS.FormsBasedAuthentication, V (0x1CAC) 0x0D70 InternetExtranetEdition        System.Exception               0 Critical Error sending mail notification    at CKS.FormsBasedAuthentication.MembershipRequest.ApproveMembership(MembershipRequest request, SPWeb web) 5f444f61-90b2-4e04-a671-c6078cad494e
07/16/2009 15:46:27.10  CKS.FormsBasedAuthentication, V (0x1CAC) 0x0D70 InternetExtranetEdition        MembershipRequest              0 Critical SendEmail failed b287e8e2-537f-419d-a3f1-725e9bc0bb7f

 

Regards

Jul 16, 2009 at 9:07 PM

check for you xsl files - sounds like they have invalid xsl in them.

Jul 16, 2009 at 9:11 PM

Thanks.  Question, are these xsl files re-created if you re-deploy the solution?  I have undeployed and redeployed the solution, so am guessing they would be the default xsl files.

Regards

 

Jul 16, 2009 at 9:12 PM

I'm not sure if they get deleted, I would manually delete them - uninstall the package , then redploy it.

Sep 9, 2009 at 4:34 PM

Here is the link to the updated source code and WSP:

 

http://www.joppasoftware.com/Sharepoint_sourcecode.aspx

 

Feel free to email me if you have any questions.