Search


Friday, April 4, 2008

Web config notes for ASP website ( password rule config, max upload file, deny annon user to access specific pages

add additional setting: add: <appSettings> <add key="SiteName" value="yoursitename"/> </appSettings> to change default annoying password rule in ASP.Net (web.config): overview: we will delete a provider named AspNetSqlMembershipProvider then we add new requirements: minRequiredPasswordLength="4", minRequiredNonalphanumericCharacters="0", and passwordStrengthRegularExpression="". means that, we can set password: min 4 chars, no non-alphanumeric needed and no rule for expression. add this code below <system.web> <membership> <providers> <remove name="AspNetSqlMembershipProvider"/> <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5"passwordAttemptWindow="10" minRequiredPasswordLength="4" minRequiredNonalphanumericCharacters="0" passwordStrengthRegularExpression=""/> </providers> </membership> change maximum file upload: 8192 KB. add below <system.web> <httpRuntime maxRequestLength="8192"></httpRuntime> deny annon user to access specific pages: add the following in tag <configuration> and after tag <appSettings> <location path="page1.aspx"> <system.web> <authorization> <deny users="?"/> </authorization> </system.web> </location> <location path="page2.aspx"> <system.web> <authorization> <deny users="?"/> </authorization> </system.web> </location> <location path="page3.aspx"> <system.web> <authorization> <deny users="?"/> </authorization> </system.web> </location>

No comments:

Post a Comment