How to send email using for website hosted on

by Rana17. September 2013 01:40

You can use below mentioned code to send email using for the website hosted on

This code will only work when run on the server.

    Public Shared Function SendEmail(ByVal ToAddress As String, ByVal Subject As String, ByVal Body As String, ByVal IsHtml As Boolean) As Boolean


            Dim smtpClient As New SmtpClient

            Dim SERVER As String = ""

            Dim _MailMessage As MailMessage = New MailMessage()


            _MailMessage.From = New MailAddress("")



            _MailMessage.Subject = Subject

            _MailMessage.IsBodyHtml = True

            _MailMessage.Priority = MailPriority.High

            _MailMessage.Body = Body


            smtpClient.Host = SERVER



            smtpClient = Nothing

            _MailMessage = Nothing


            Return True


        Catch ex As Exception

            Return False

        End Try

    End Function


Different formulas usually required when sales tax is involved

by Rana2. September 2013 09:30

1. Total = Net Price + (Net Price x Tax Rate)

When you know the Net Price and Tax Rate, you can use above formula to calculate the final amount to charge. Your net price should be after deducting any discounts.

2. Tax Rate = (Total ÷ Net Price) -1

Use above formula if you want to know the tax rate. Some times you know the total amount and net price but don't know the tax rate.

3. Net Price = Total ÷ (Tax Rate + 1)

Use above formula when you want to know the Net Price.

4. Tax Amount = Total - (Total ÷ (Tax Rate + 1))

And if you have Total amount and tax rate and want to know about the tax amount then use above formula.


Set Session Timeout ASP.Net using web.config

by Rana29. July 2013 23:35
You can set session timeout using following section in web.config file.

          <sessionState timeout="20">

Tags: , ,


How to change behaviour of taskbar grouping in windows xp

by Rana6. June 2013 01:33

When you enable taskbar grouping (right click taskbar, choose properties, option "Group similar taskbar buttons") it by default group items when there is very less space available on taskbar.

By default xp group items which were opened first but you can change this default behavior using registry. See following steps

To change this behavior, create a "TaskbarGroupSize" DWORD entry in the following registry key:


The values for this key are:

0 - (Default) Group by age (oldest group first)
1 - Group by size (largest group first)
2 - Group any group of size 2 or more
3 - Group any group of size 3 or more

Log off and then back on for this change to take effect.

Read Original Microsoft Post

Tags: ,


BlogEngine.Net Email Setting For GoDaddy Hosting

by Rana5. June 2013 03:49

When you host your BlogEngine.Net on GoDaddy you need to have following setting in order to enable emailing.

E-mail address:


Port number: 25


Password: yourpassword

Other settings: Uncheck "Enable SSL"

Tags: , , ,


Log4Net Error - Configuration system failed to initialize

by Rana4. June 2013 00:47

After adding configuration entry for log4net in web.config/app.config you may face error "Configuration system failed to initialize".

Sample config entry to log entries in text file.

<appender name="FileAppender" type="log4net.Appender.FileAppender">

  <file value="log-file.txt" />

  <appendToFile value="true" />

  <layout type="log4net.Layout.PatternLayout">

    <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />




To resolve the issue you must add following in your config file.



    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />



Tags: ,


Run Multiple Skype on One Computer

by Administrator29. May 2013 01:37

Do you have more than one skype accounts which you want to use on one computer. It is possible by using following method:

1. Create a shortcut of skype

2. Right click on shortcut and click properties.

3. Select Shortcut tab if not already selected and type "/secondary" at the end of Target string.


It will allow you to run multiple skypes using the above created shortcut but you will have to type in the user name and password. If you want to save that as well, then add following strings as well in the target. "username:myuser /password:mypassword". Complete string would look something like this

"C:\Program Files (x86)\Skype\Phone\Skype.exe" /secondary /username:myuser /password:mypassword

Make sure you don't change your path to match above shown in example :)

Tags: ,


How do you give a C# Auto-Property a default value?

by Rana9. May 2013 04:00

You can achieve it by setting default value in the constructor of the class.

See example below

Example #1

class Person

  FirstName="Default Name";


  FirstName { get;set; }


Tags: ,

c# | Microsoft

Hide Result/Messages window in Sql Server Management Studio

by Rana30. April 2013 00:50

Developers usually avoid using mouse because you have to move your hand from keyboard to mouse. In Sql Server whenever you execute any query it shows result/messages window and you have to use your mouse to resize it to see your query in full size again.

There is a shortcut key Ctrl+R to toggle result/messages window. This shortcut key is very handy when working with queries in sql server.

Tags: ,


Problem in Consuming WCF Service from WebApi

by Rana14. February 2013 04:47

I was trying to consume SecureNet (Payment Gateway) wcf service within web api today. I added a reference in my web api project but was not able to access the service through proxy class. I found many warnings, one of them is below

Warning    1    Custom tool warning: Cannot import wsdl:portType Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter Error: Type 'Newtonsoft.Json.Linq.JToken' is a recursive collection data contract which is not supported. Consider modifying the definition of collection 'Newtonsoft.Json.Linq.JToken' to remove references to itself. XPath to Error Source: //wsdl:definitions[@targetNamespace='']/wsdl:portType[@name='IGateway']    c:\Project\Service References\SecureNet\Reference.svcmap    1    1    Project

I found that the problem was due to the reuse of assemblies in referenced services. You should either un-check this option when adding reference of service (in advance menu) or select only the assemblies which are required to reuse.

New Reference

If you are adding new reference then click "Advanced..." button and un-check "Reuse types in referenced assemblies" (see below image).


Fix Existing Reference

If you have already added a reference and finding solution to fix it then right click on service reference (Solution Explorer > Service References > YourServiceReference) and select "Configure Service Reference..." option. You will see a configuration window (see above image) where you can un-check the "Reuse types in referenced assemblies" option.

Tags: , , ,

Month List