How to authenticate the Inbox in Microsoft Exchange Server 2003 with forms-based authentication enabled?

Please find the Code Snippet Access Exchange Server 2003 using WebDAV in your Web application per KB:

    1:  'Declaration Section
    2:  Dim strServerName as String = "Server Name"     'TODO: Change to your environment
    3:  Dim strDomain as String = "Domain Name"       'TODO: Change to your environment
    4:  Dim strUserID as String = "Username"            'TODO: Change to your environment
    5:  Dim strPassword as String = "Password"        'TODO: Change to your environment
    7:  ' Create our destination URL.
    8:  Dim strURL As String = "https:/" & strServerName & "/exchange" & strUserName & "/inbox/test.eml"
    9:  Dim strReusableCookies As String
   11:  ' Create our Web request object.
   12:  GETRequest = CType(WebRequest.Create(New System.Uri(strURL & strApptItem)), HttpWebRequest)
   13:  strReusableCookies = AuthenticateSecureOWA(strServerName, strDomain, strUserID, strPassword)
   15:  ' Add the cookie set that is obtained after OWA authentication to our request header.
   16:  PROPPATCHRequest.Headers.Add("Cookie", strReusableCookies)
   17:  PROPPATCHRequest.ContentType = "text/xml"
   18:  PROPPATCHRequest.KeepAlive = True
   19:  PROPPATCHRequest.AllowAutoRedirect = False
   21:  ' Specify the PROPPATCH method.
   22:  PROPPATCHRequest.Method = "GET"
   24:  ' Enter your WebDAV-related code here.
   25:  ...

There are two ways of implementing this.

Method # 1: In the Visual Basic .NET code sample that was just mentioned, the strReusableCookies string variable is the authentication cookie that is returned from the AuthenticateSecureOWA function call. If the authentication cookie times out, call the AuthenticateSecureOWA function again to receive a new authentication cookie.

Method # 2: Put the WebDAV request in a try/catch block. The try/catch block will catch the authentication cookie time-out error. When the authentication cookie time-out error occurs, you can re-authenticate the Inbox in Exchange Server 2003 to the Exchange Server 2003 server that is enabled with forms-based authentication.