0

I have written a ASP.NET to sent SMTP mail for every 12 hours .It works fine in my office server but when i run the solution in my clients server it shows me an error "The remote certificate is invalid according to the validation procedure". what will the problem and what is the solution for it?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
user2536023
  • 165
  • 1
  • 4
  • 14
  • It doesn't "shows you an error", it throws an exception. Please post the full exception. – John Saunders Jul 16 '13 at 01:21
  • Is the client using a self signed certificate for their mail server? One of these is most likely to be the issue: http://stackoverflow.com/a/9983342/264607 – BlackICE Jul 16 '13 at 01:52

1 Answers1

0

There are a few questions out there already :

(Great Feedback on what to check) The remote certificate is invalid according to the validation procedure

(Code To Run on non-prod to get past errors) "The remote certificate is invalid according to the validation procedure." using Gmail SMTP server

(Additional Info)The remote certificate is invalid according to the validation procedure

If Those Don't Work

Try adding the certificates on the server

  1. Save the certificate to your computer you need to add the certificate too.
  2. Start -> Run -> MMC This will open the Microsoft Management Console
  3. Go to File -> Add/Remove Snap-in... Select Certificates from the Available snap-ins: box and click Add >
  4. You will have three options (User,Service,Computer), select Computer account and hit Next >.Hit Finish to close the dialog, and OK to close the snap-in dialog
  5. Right click Trusted Root Certification Authorities -> All Tasks -> Import...
  6. Hit Next >, browse the certificate, and hit next until the dialog closes and you have successfully added the certificate.

Run a Trace to See Error Message

Add the following to your web.config. (Taken from here)

<system.diagnostics>
    <trace autoflush="true" />
            <sources>
            <source name="System.Net">
                    <listeners>
            <add name="System.Net"/>
                    </listeners>
            </source>
            <source name="System.Net.HttpListener">
                    <listeners>
            <add name="System.Net"/>
                    </listeners>
            </source>
    <source name="System.Net.Sockets">
                    <listeners>
            <add name="System.Net"/>
                    </listeners>
            </source>
    <source name="System.Net.Cache">
                    <listeners>
            <add name="System.Net"/>
                    </listeners>
            </source>
            </sources>
    <sharedListeners>
            <add
             name="System.Net"
             type="System.Diagnostics.TextWriterTraceListener"
              initializeData="System.Net.trace.log"
             traceOutputOptions = "ProcessId, DateTime"
            />
    </sharedListeners>
<switches>
    <add name="System.Net" value="Verbose" />
    <add name="System.Net.Sockets" value="Verbose" />
    <add name="System.Net.Cache" value="Verbose" />
    <add name="System.Net.HttpListener" value="Verbose" />
</switches>
</system.diagnostics>

This will give you a closer look at what's wrong. ie. name mismatch, etc.. Be sure to change the initializeData="System.Net.trace.log" to location of your log and make sure network service has r/w access.

Community
  • 1
  • 1
Jacob Saylor
  • 2,371
  • 1
  • 31
  • 46