Sunday, 12 July 2020

.Net Core ASPNETCORE_ENVIRONMENT Variable

If you are working with .Net Core and something wrong has happened and you see the below screen, and need to know the details of the exception


By default, the ASPNETCORE_ENVIRONMENT variable is set to Production to prevent showing sensitive data to end-users
Add the below lines to your web.config to show the details of the error 
<aspNetCore processPath=".\MyApplication.exe" arguments="" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout">
      <environmentVariables>
        <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
      </environmentVariables>
    </aspNetCore>

Thursday, 9 July 2020

Error sending email from gmail - p=BadCredentials e23sm4003047wme.35


You may face an issue while sending email from C# using Gmail account
If your code is fine and your Gmail username/password is correct but you still get the below exception in  "client.Authenticate"

gmail p=BadCredentials e23sm4003047wme.35 - gsmtp

Then the problem is in your Gmail account settings, you have to allow less secure app to access your account and use it for sending emails

Go to Gmail settings and search for "Less secure app access" and turn it on, as below screenshot.




References:
https://support.google.com/accounts/answer/6010255