Create Text File Without BOM

Well it writes the BOM because you are instructing it to, in the line Encoding utf8WithoutBom = new UTF8Encoding(true); true means that the BOM should be emitted, using Encoding utf8WithoutBom = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false); writes no BOM. My objective is create a file using UTF-8 as Encoding and 8859-1 as CharSet Sadly, this is not … Read more

Stopping onclick from firing when onclientclick is false?

You want to add return inside OnClientClick after a function is called. Otherwise, the button will post back even if function returns false. <asp:button ID=”Button1″ runat=”server” OnClick=”Button1_Click” OnClientClick=”return checkValidation()” Text=”Submit” /> <script type=”text/javascript”> function checkValidation() { return confirm(‘Everything ok?’); } </script>

log4net – Appenders not working in IIS7.5

You can enable log4net internal debugging by adding the key log4net.Internal.Debug to your application configuration file. <appSettings> <add key=”log4net.Internal.Debug” value=”true”/> </appSettings> This will write debug messages to the console and the System.Diagnostics.Trace system. You can then log these messages to a text file by adding a trace listener to you configuration file. Make sure the … Read more

Convert a string to a datetime

You should have to use Date.ParseExact or Date.TryParseExact with correct format string. Dim edate = “10/12/2009” Dim expenddt As Date = Date.ParseExact(edate, “dd/MM/yyyy”, System.Globalization.DateTimeFormatInfo.InvariantInfo) OR Dim format() = {“dd/MM/yyyy”, “d/M/yyyy”, “dd-MM-yyyy”} Dim expenddt As Date = Date.ParseExact(edate, format, System.Globalization.DateTimeFormatInfo.InvariantInfo, Globalization.DateTimeStyles.None) OR Dim format() = {“dd/MM/yyyy”, “d/M/yyyy”, “dd-MM-yyyy”} Dim expenddt As Date Date.TryParseExact(edate, format, System.Globalization.DateTimeFormatInfo.InvariantInfo, Globalization.DateTimeStyles.None, … Read more