Posts

Showing posts from 2015

Enable HTTP Transport Security (HSTS) in IIS 7

Q.  What is the best way to turn on   HTTP Strict Transport Security   on an IIS 7 web server? Ans:  This can be done by adding following block in Web.Config:               <system.webServer>                     <httpProtocol>                          <customHeaders>                               <add name ="X-CustomName" value="MyCustomValue"/>                                               </customHeaders>                    </httpProtocol>             </system.webServer> We have to configure on IIS that has the ability to custom headers to response: Go to Internet Information Services(IIS) Manager. Configure Response headers that are added to response from the server. Now add your custom header Name and custom Value (Custom header name and value should be same as that in Web.Config).
SQL Error : String or binary data would be truncated While working on an application I found an error 'String or binary data would be truncated.After finding the solution I thought to publish it. Whenever you see the message :   string or binary data would be truncated That means the field is NOT big enough to hold my data. Check the table structure you will find that the length of one or more fields is not big enough to hold the data you trying to insert. For example : As the column ' FIRSTNAME VARCHAR(5)' is able to hold 5 characters and you are trying to put characters greater than  5 in it then you will get this error.Increase the size of the field or decrease the value while inserting.