Monday, May 25, 2015

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.

Hello,
While I was trying to send an email from a website using gmail account, I didn't have any issues testing on my local machine but getting to work from production server was a pain.
I was keep getting error message:

"The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required."

3 things will fix it:
  1. Go to security settings at the following link https://www.google.com/settings/security/lesssecureapps and enable less secure apps. This will enable google to login from all apps.
  2. Enable other ip/timezone for your google account by clicking on following link and click continue to give access: https://g.co/allowaccess
  3. Go to account settings 
    • Under Recent Activity section, click on "Notifications and Alerts" 
    • Now there you will see "Unusual Activity". 
    • Select your related event and approve it by clicking "Yes, That was me!".   This way google will add this clear this activity from suspicious list of activities.
HTH

Tuesday, May 19, 2015

Why my website is running in 32 bit mode in Visual Studio?

I was working on a website in Visual Studio 2013 in 64 bit machine. The properties of solution/project was set to run as Any CPU which means to run the app as 64 bit when 64 bit processor found else 32 bit.

In my 64 bit machine, the website was being starting as 32 bit and the reason was that the process hosting the website was "IISExpress" and it was being run in 32 bit mode.

Again, the Any CPU flag also follow the caller of the app. 
If the caller of app is running in 32 bit, the application would run in same as well.

Anyways, to change the IISExpress to run as 64 bit, check the box under :

Tools | Options | Projects and Solutions | Web Projects | Use the 64 bit version of IIS Express

HTH


Monday, May 4, 2015

SQL Server Stored Procedure Alter / View / Execute Permissions

There are different ways to grant user permission to alter, view or execute stored procedures.
The easiest approach I found was to create a "Database Role".
Name anything you like. I liked "db_executor" role.
Now give this role permissions and then add users to this role.

So..

/* Create a new role for stored procedure permissions */
CrEATE ROLE db_executor

/* Grant stored procedure Alter/View/Execute rights to the role */
GRANT ALTER, VIEW DEFINITION, EXECUTE TO [db_executor]

/* Add a user to the db_executor role */
EXEC sp_addrolemember 'db_executor', [domain\userid]  -- No single quotes around user.