Tuesday, June 9, 2015
Monday, June 8, 2015
Make hard coding your default choice
http://enterprisecraftsmanship.com/2015/06/08/make-hard-coding-your-default-choice/
To my experiences, I divide this kind of "magic number" into three categories:
#1 Very small chance to change: Hard coding
#2 Good chance to change in the future:
Hard coding with default value but checking config file first
string ConfigSetting_SMTP_host = ConfigurationManager.AppSettings["SMTP_host"] ?? "google.com";
#3 For sure change (such as dev vs product environment): read from config file directly
To my experiences, I divide this kind of "magic number" into three categories:
#1 Very small chance to change: Hard coding
#2 Good chance to change in the future:
Hard coding with default value but checking config file first
string ConfigSetting_SMTP_host = ConfigurationManager.AppSettings["SMTP_host"] ?? "google.com";
#3 For sure change (such as dev vs product environment): read from config file directly
Tuesday, June 2, 2015
How to solve Access is denied problem for a ASP.NET MVC 4 Windows Authentication project
Create a ASP.NET MVC 4 intranet project, and run, get following error:
Access is denied
Description: An error occurred while accessing the resources required to serve this request. The server may not be configured for access to the requested URL.
Error message 401.2.: Unauthorized: Logon failed due to server configuration. Verify that you have permission to view this directory or page based on the credentials you
supplied and the authentication methods enabled on the Web server. Contact the Web server's administrator for additional assistance.
Solution:
Press F4 to get project property windows:
Change Anonymous to Disabled
Change Windows Authentication to Enabled.
(Why just publish a correct project template for Windows Authentication in the first place?)
Friday, May 29, 2015
Thursday, May 28, 2015
Subscribe to:
Posts (Atom)
