ASP.NET Error Handling

John Doe ·

2858 Views

< Sample Code 1 : / >

Server Error in '/' Application.
Conversion from string "" to type 'Decimal' is not valid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Conversion from string "" to type 'Decimal' is not valid.

Source Error:

Line 91: 				city = reader_ull("City").ToString()
Line 92: 				zip = reader_ull("Zip").ToString()
Line 93: 				lat = reader_ull("Latitude").ToString()
Line 94: 				lng = reader_ull("Longitude").ToString()
Line 95: 

Source File: D:\home\site\wwwroot\include\functions.aspx    Line: 93

Stack Trace:

[InvalidCastException: Conversion from string "" to type 'Decimal' is not valid.]
   Microsoft.VisualBasic.CompilerServices.Conversions.ToDecimal(String Value, NumberFormatInfo NumberFormat) +254
   Microsoft.VisualBasic.CompilerServices.Conversions.ToDecimal(String Value) +6
   ASP.default_aspx.GetLocation() in D:\home\site\wwwroot\include\functions.aspx:93
   ASP.default_aspx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in D:\home\site\wwwroot\include\head1.aspx:12
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +256
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
   System.Web.UI.Page.Render(HtmlTextWriter writer) +29
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266

Version Information: Microsoft .NET Framework Version:2.0.50727.8964; ASP.NET Version:2.0.50727.8962

 

< Sample Code 2 : /include/functions.aspx >

Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30451: Name 'userLat' is not declared.

Source Error:

Line 34: 	If Not latCookie Is Nothing And Not lngCookie Is Nothing And Request.Querystring("nolocation") <> "nolocation"
Line 35: 		Try
Line 36: 			userLat = latCookie.Value
Line 37: 			userLng = lngCookie.Value
Line 38: 			userLocation = Request.Cookies("Location").Value.ToString().Replace("_", " ")

Source File: D:\home\site\wwwroot\include\functions.aspx    Line: 36


Compiler Warning Messages:
Warning: BC42104: Variable 'ipFinal' is used before it has been assigned a value. A null reference exception could result at runtime.
Source Error:

D:\home\site\wwwroot\include\functions.aspx

Line 13: 	End If
Line 14: 
Line 15: 	If ipFinal = Nothing
Line 16: 		ipFinal = context.Request.ServerVariables("REMOTE_ADDR")
Line 17: 	End If

Warning: BC42024: Unused local variable: 'R'.
Source Error:

D:\home\site\wwwroot\include\functions.aspx

Line 432:
Line 433:Function stripHtml(ByVal Y As String) As String
Line 434:	Dim R As RegEx
Line 435:	
Line 436:	If Y = Nothing Then Return("")

Warning: BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
Source Error:

D:\home\site\wwwroot\include\functions.aspx

Line 436:	If Y = Nothing Then Return("")
Line 437:
Line 438:	Y=R.Replace(Y, "<[^>]*(>|$)", "")
Line 439:
Line 440:	Return(Y)

Warning: BC42021: Function without an 'As' clause; return type of Object assumed.
Source Error:

D:\home\site\wwwroot\include\functions.aspx

Line 441:End Function
Line 442:
Line 443:Function getStateSmall(ByVal strState As String)
Line 444:	Select Case (strState & "").ToLower()
Line 445:		Case "alabama"

Warning: BC42021: Function without an 'As' clause; return type of Object assumed.
Source Error:

D:\home\site\wwwroot\include\functions.aspx

Line 578:End Function
Line 579:
Line 580:Function getStatePath(ByVal strState As String)
Line 581:	Select Case (strState & "").ToUpper()
Line 582:		Case "AL"

Warning: BC42021: Function without an 'As' clause; return type of Object assumed.
Source Error:

D:\home\site\wwwroot\include\functions.aspx

Line 715:End Function
Line 716:
Line 717:Function getStateLarge(ByVal strState As String)
Line 718:	Select Case (strState & "").ToUpper()
Line 719:		Case "AL"

 

Show Detailed Compiler Output:

D:\Windows\system32> "D:\Windows\Microsoft.NET\Framework\v3.5\vbc.exe" /t:library /utf8output /R:"D:\Windows\assembly\GAC_MSIL\System.ServiceModel\3.0.0.0__b77a5c561934e089\System.ServiceModel.dll" /R:"D:\Windows\assembly\GAC_MSIL\System.Web.Mobile\2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll" /R:"D:\Windows\assembly\GAC_MSIL\System.Web.Extensions\3.5.0.0__31bf3856ad364e35\System.Web.Extensions.dll" /R:"D:\Windows\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll" /R:"D:\local\Temporary ASP.NET Files\root\f32c0fa1\240b01cd\assembly\dl3\5c15a322\fc3a3152_020dd201\ICSharpCode.SharpZipLib.DLL" /R:"D:\Windows\assembly\GAC_MSIL\System.Data.DataSetExtensions\3.5.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll" /R:"D:\Windows\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll" /R:"D:\local\Temporary ASP.NET Files\root\f32c0fa1\240b01cd\assembly\dl3\64a3753b\6fb7dd7d_0facd301\Yahoo.Yui.Compressor.DLL" /R:"D:\Windows\assembly\GAC_MSIL\System.Xml.Linq\3.5.0.0__b77a5c561934e089\System.Xml.Linq.dll" /R:"D:\Windows\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"D:\local\Temporary ASP.NET Files\root\f32c0fa1\240b01cd\assembly\dl3\e3a49068\6ab1597e_0facd301\EcmaScript.NET.DLL" /R:"D:\Windows\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"D:\Windows\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"D:\Windows\assembly\GAC_MSIL\System.Runtime.Serialization\3.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll" /R:"D:\local\Temporary ASP.NET Files\root\f32c0fa1\240b01cd\assembly\dl3\a6609ab6\d713f658_479cd301\Newtonsoft.Json.DLL" /R:"D:\Windows\assembly\GAC_MSIL\System.Web.Services\2.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll" /R:"D:\Windows\assembly\GAC_MSIL\System.ServiceModel.Web\3.5.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll" /R:"D:\Windows\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"D:\local\Temporary ASP.NET Files\root\f32c0fa1\240b01cd\App_global.asax.zpcwrfkc.dll" /R:"D:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll" /R:"D:\Windows\assembly\GAC_MSIL\System.IdentityModel\3.0.0.0__b77a5c561934e089\System.IdentityModel.dll" /R:"D:\Windows\assembly\GAC_MSIL\System.WorkflowServices\3.5.0.0__31bf3856ad364e35\System.WorkflowServices.dll" /R:"D:\Windows\assembly\GAC_MSIL\System.Web.Routing\3.5.0.0__31bf3856ad364e35\System.Web.Routing.dll" /R:"D:\Windows\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll" /out:"D:\local\Temporary ASP.NET Files\root\f32c0fa1\240b01cd\App_Web_functions.aspx.c8a18792.nv4jgu4j.dll" /D:DEBUG=1 /debug+ /define:_MYTYPE=\"Web\" /imports:Microsoft.VisualBasic,System,System.Collections,System.Collections.Generic,System.Collections.Specialized,System.Configuration,System.Text,System.Text.RegularExpressions,System.Linq,System.Xml.Linq,System.Web,System.Web.Caching,System.Web.SessionState,System.Web.Security,System.Web.Profile,System.Web.UI,System.Web.UI.WebControls,System.Web.UI.WebControls.WebParts,System.Web.UI.HtmlControls /warnaserror- /optionInfer+  "D:\local\Temporary ASP.NET Files\root\f32c0fa1\240b01cd\App_Web_functions.aspx.c8a18792.nv4jgu4j.0.vb" "D:\local\Temporary ASP.NET Files\root\f32c0fa1\240b01cd\App_Web_functions.aspx.c8a18792.nv4jgu4j.1.vb"


Microsoft (R) Visual Basic Compiler version 9.0.30729.8763
Copyright (c) Microsoft Corporation.  All rights reserved.

D:\home\site\wwwroot\include\functions.aspx(15) : warning BC42104: Variable 'ipFinal' is used before it has been assigned a value. A null reference exception could result at runtime.

    If ipFinal = Nothing
       ~~~~~~~          
D:\home\site\wwwroot\include\functions.aspx(36) : error BC30451: Name 'userLat' is not declared.

            userLat = latCookie.Value
            ~~~~~~~                  
D:\home\site\wwwroot\include\functions.aspx(37) : error BC30451: Name 'userLng' is not declared.

            userLng = lngCookie.Value
            ~~~~~~~                  
D:\home\site\wwwroot\include\functions.aspx(38) : error BC30451: Name 'userLocation' is not declared.

            userLocation = Request.Cookies("Location").Value.ToString().Replace("_", " ")
            ~~~~~~~~~~~~                                                                 
D:\home\site\wwwroot\include\functions.aspx(72) : error BC30002: Type 'SqlConnection' is not defined.

            Dim conn_ull As New SqlConnection(Application("ConnectionString"))
                                ~~~~~~~~~~~~~                                 
D:\home\site\wwwroot\include\functions.aspx(73) : error BC30002: Type 'SqlCommand' is not defined.

            Dim cmd_ull As New SqlCommand()
                               ~~~~~~~~~~  
D:\home\site\wwwroot\include\functions.aspx(84) : error BC30002: Type 'SqlDataReader' is not defined.

            Dim reader_ull As SqlDataReader = cmd_ull.ExecuteReader()
                              ~~~~~~~~~~~~~                          
D:\home\site\wwwroot\include\functions.aspx(119) : error BC30451: Name 'userLat' is not declared.

                        userLat = lat
                        ~~~~~~~      
D:\home\site\wwwroot\include\functions.aspx(123) : error BC30451: Name 'userLng' is not declared.

                        userLng = lng
                        ~~~~~~~      
D:\home\site\wwwroot\include\functions.aspx(127) : error BC30451: Name 'userLocation' is not declared.

                        userLocation = location
                        ~~~~~~~~~~~~           
D:\home\site\wwwroot\include\functions.aspx(140) : error BC30451: Name 'userLocation' is not declared.

    If userLocation = ""
       ~~~~~~~~~~~~     
D:\home\site\wwwroot\include\functions.aspx(141) : error BC30451: Name 'userLocation' is not declared.

        userLocation = "Edit Location"
        ~~~~~~~~~~~~                  
D:\home\site\wwwroot\include\functions.aspx(143) : error BC30451: Name 'userLocation' is not declared.

        If userLocation.IndexOf(",") > -1
           ~~~~~~~~~~~~                  
D:\home\site\wwwroot\include\functions.aspx(144) : error BC30451: Name 'userLocationCity' is not declared.

            userLocationCity = userLocation.SubString(0, userLocation.IndexOf(","))
            ~~~~~~~~~~~~~~~~                                                       
D:\home\site\wwwroot\include\functions.aspx(144) : error BC30451: Name 'userLocation' is not declared.

            userLocationCity = userLocation.SubString(0, userLocation.IndexOf(","))
                               ~~~~~~~~~~~~                                        
D:\home\site\wwwroot\include\functions.aspx(144) : error BC30451: Name 'userLocation' is not declared.

            userLocationCity = userLocation.SubString(0, userLocation.IndexOf(","))
                                                         ~~~~~~~~~~~~              
D:\home\site\wwwroot\include\functions.aspx(145) : error BC30451: Name 'userLocationState' is not declared.

            userLocationState = userLocation.SubString(userLocation.IndexOf(","))
            ~~~~~~~~~~~~~~~~~                                                    
D:\home\site\wwwroot\include\functions.aspx(145) : error BC30451: Name 'userLocation' is not declared.

            userLocationState = userLocation.SubString(userLocation.IndexOf(","))
                                ~~~~~~~~~~~~                                     
D:\home\site\wwwroot\include\functions.aspx(145) : error BC30451: Name 'userLocation' is not declared.

            userLocationState = userLocation.SubString(userLocation.IndexOf(","))
                                                       ~~~~~~~~~~~~              
D:\home\site\wwwroot\include\functions.aspx(146) : error BC30451: Name 'userLocationState' is not declared.

            userLocationState = userLocationState.Trim(",")
            ~~~~~~~~~~~~~~~~~                              
D:\home\site\wwwroot\include\functions.aspx(146) : error BC30451: Name 'userLocationState' is not declared.

            userLocationState = userLocationState.Trim(",")
                                ~~~~~~~~~~~~~~~~~          
D:\home\site\wwwroot\include\functions.aspx(147) : error BC30451: Name 'userLocationState' is not declared.

            userLocationState = userLocationState.Trim()
            ~~~~~~~~~~~~~~~~~                           
D:\home\site\wwwroot\include\functions.aspx(147) : error BC30451: Name 'userLocationState' is not declared.

            userLocationState = userLocationState.Trim()
                                ~~~~~~~~~~~~~~~~~       
D:\home\site\wwwroot\include\functions.aspx(188) : error BC30002: Type 'SqlConnection' is not defined.

            Dim objConn_ull As New SqlConnection(Application("ConnectionStringReadOnly"))
                                   ~~~~~~~~~~~~~                                         
D:\home\site\wwwroot\include\functions.aspx(189) : error BC30002: Type 'SqlCommand' is not defined.

            Dim objCmd_ull As New SqlCommand(strSQL_ull, objConn_ull)
                                  ~~~~~~~~~~                         
D:\home\site\wwwroot\include\functions.aspx(193) : error BC30002: Type 'SqlDataReader' is not defined.

            Dim objR_ull As SqlDataReader=objCmd_ull.ExecuteReader()
                            ~~~~~~~~~~~~~                           
D:\home\site\wwwroot\include\functions.aspx(391) : error BC30002: Type 'SqlConnection' is not defined.

        Dim objConn As New SqlConnection(Application("ConnectionString"))
                           ~~~~~~~~~~~~~                                 
D:\home\site\wwwroot\include\functions.aspx(392) : error BC30002: Type 'SqlCommand' is not defined.

        Dim objCmd As New SqlCommand(strQuery, objConn)
                          ~~~~~~~~~~                   
D:\home\site\wwwroot\include\functions.aspx(408) : error BC30002: Type 'SqlConnection' is not defined.

        Dim objConn As New SqlConnection(Application("ConnectionString"))
                           ~~~~~~~~~~~~~                                 
D:\home\site\wwwroot\include\functions.aspx(409) : error BC30002: Type 'SqlCommand' is not defined.

        Dim objCmd As New SqlCommand(strQuery, objConn)
                          ~~~~~~~~~~                   
D:\home\site\wwwroot\include\functions.aspx(434) : warning BC42024: Unused local variable: 'R'.

    Dim R As RegEx
        ~         
D:\home\site\wwwroot\include\functions.aspx(438) : warning BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.

    Y=R.Replace(Y, "<[^>]*(>|$)", "")
      ~~~~~~~~~                      
D:\home\site\wwwroot\include\functions.aspx(443) : warning BC42021: Function without an 'As' clause; return type of Object assumed.

Function getStateSmall(ByVal strState As String)
         ~~~~~~~~~~~~~                          
D:\home\site\wwwroot\include\functions.aspx(580) : warning BC42021: Function without an 'As' clause; return type of Object assumed.

Function getStatePath(ByVal strState As String)
         ~~~~~~~~~~~~                          
D:\home\site\wwwroot\include\functions.aspx(717) : warning BC42021: Function without an 'As' clause; return type of Object assumed.

Function getStateLarge(ByVal strState As String)

 

Show Complete Compilation Source:

Line 1:    #ExternalChecksum("D:\home\site\wwwroot\include\functions.aspx","{406ea660-64cf-4c82-b6f0-42d48172a799}","3823AE249D40949B8E2B4709D23B67DB")
Line 2:    '------------------------------------------------------------------------------
Line 3:    ' <auto-generated>
Line 4:    '     This code was generated by a tool.
Line 5:    '     Runtime Version:2.0.50727.8964
Line 6:    '
Line 7:    '     Changes to this file may cause incorrect behavior and will be lost if
Line 8:    '     the code is regenerated.
Line 9:    ' </auto-generated>
Line 10:   '------------------------------------------------------------------------------
Line 11:   
Line 12:   Option Strict Off
Line 13:   Option Explicit On
Line 14:   
Line 15:   Imports Microsoft.VisualBasic
Line 16:   Imports System
Line 17:   Imports System.Collections
Line 18:   Imports System.Collections.Generic
Line 19:   Imports System.Collections.Specialized
Line 20:   Imports System.Configuration
Line 21:   Imports System.Linq
Line 22:   Imports System.Security.Cryptography
Line 23:   Imports System.Text
Line 24:   Imports System.Text.RegularExpressions
Line 25:   Imports System.Web
Line 26:   Imports System.Web.Caching
Line 27:   Imports System.Web.Profile
Line 28:   Imports System.Web.Security
Line 29:   Imports System.Web.SessionState
Line 30:   Imports System.Web.UI
Line 31:   Imports System.Web.UI.HtmlControls
Line 32:   Imports System.Web.UI.WebControls
Line 33:   Imports System.Web.UI.WebControls.WebParts
Line 34:   Imports System.Xml.Linq
Line 35:   
Line 36:   Namespace ASP
Line 37:       
Line 38:       <System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()>  _
Line 39:       Public Class include_functions_aspx
Line 40:           Inherits Global.System.Web.UI.Page
Line 41:           Implements System.Web.SessionState.IRequiresSessionState, System.Web.IHttpHandler
Line 42:           
Line 43:           Private Shared __initialized As Boolean
Line 44:           
Line 45:           Private Shared __fileDependencies As Object
Line 46:           
Line 47:           
Line 48:           #ExternalSource("D:\home\site\wwwroot\include\functions.aspx",2)
Line 49:                          
Line 50:   Dim geoIpTable As String = "B"
Line 51:   
Line 52:   Function getIpAddress() As String
Line 53:   	Dim context As System.Web.HttpContext = System.Web.HttpContext.Current
Line 54:   	Dim tmpIp As String = context.Request.ServerVariables("HTTP_X_FORWARDED_FOR")
Line 55:   	Dim ipFinal As String
Line 56:   
Line 57:   	If tmpIp <> Nothing
Line 58:   		Dim ipArray As String() = tmpIp.Split(",")
Line 59:           ipFinal = (ipArray(ipArray.Length-1) & "").Replace("'", "''").Trim()
Line 60:   	End If
Line 61:   
Line 62:   	If ipFinal = Nothing
Line 63:   		ipFinal = context.Request.ServerVariables("REMOTE_ADDR")
Line 64:   	End If
Line 65:   
Line 66:   	If ipFinal = Nothing
Line 67:   		ipFinal = HttpContext.Current.Request.UserHostAddress
Line 68:   	End If
Line 69:   
Line 70:   	If ipFinal.IndexOf(":") > -1
Line 71:   		ipFinal = ipFinal.SubString(0, ipFinal.IndexOf(":"))
Line 72:   	End If
Line 73:   
Line 74:   	Return ipFinal
Line 75:   End Function
Line 76:   
Line 77:   Sub GetLocation()
Line 78:   	Dim latCookie As HttpCookie=Request.Cookies("Latitude")
Line 79:   	Dim lngCookie As HttpCookie=Request.Cookies("Longitude")
Line 80:   
Line 81:   	If Not latCookie Is Nothing And Not lngCookie Is Nothing And Request.Querystring("nolocation") <> "nolocation"
Line 82:   		Try
Line 83:   			userLat = latCookie.Value
Line 84:   			userLng = lngCookie.Value
Line 85:   			userLocation = Request.Cookies("Location").Value.ToString().Replace("_", " ")
Line 86:   		Catch
Line 87:   			
Line 88:   		End Try
Line 89:   	ElseIf IsBot() = False And Request.Querystring("nolocation") <> "nolocation"
Line 90:   		Dim ip As String = getIpAddress() ''//Request.ServerVariables("REMOTE_ADDR")
Line 91:   		If ip.IndexOf("192.168.1.") > -1 Then ip = "47.21.19.98"
Line 92:   		Dim ipArray() As String = ip.Split(".")
Line 93:   		Dim locationValue As Int64, z As Int32, invalidLocation As Boolean
Line 94:   
Line 95:   		For Each i As String In ipArray
Line 96:   			If Not IsNumeric(i)
Line 97:   				Exit For
Line 98:   			End If
Line 99:   
Line 100:  			z += 1
Line 101:  
Line 102:  			Select Case z
Line 103:  				Case 1
Line 104:  					locationValue = Convert.ToInt64(i) * 16777216
Line 105:  				Case 2
Line 106:  					locationValue += Convert.ToInt64(i) * 65536
Line 107:  				Case 3
Line 108:  					''//locationValue += Convert.ToInt64(i) * 97
Line 109:  					locationValue += Convert.ToInt64(i) * 256
Line 110:  				Case 4
Line 111:  					locationValue += Convert.ToInt64(i)
Line 112:  				Case Else
Line 113:  					invalidLocation = True
Line 114:  					Exit For
Line 115:  			End Select
Line 116:  		Next
Line 117:  
Line 118:  		If locationValue > 0 And invalidLocation = False
Line 119:  			Dim conn_ull As New SqlConnection(Application("ConnectionString"))
Line 120:  			Dim cmd_ull As New SqlCommand()
Line 121:  
Line 122:  			cmd_ull.CommandText = "GetGeoIP2Location"
Line 123:  			cmd_ull.CommandType = System.Data.CommandType.StoredProcedure
Line 124:  			cmd_ull.Connection = conn_ull
Line 125:  
Line 126:  			cmd_ull.Parameters.Add("@LocationValue", System.Data.SqlDbType.BigInt)
Line 127:  			cmd_ull.Parameters("@LocationValue").Value = locationValue
Line 128:  
Line 129:  			conn_ull.Open()
Line 130:  
Line 131:  			Dim reader_ull As SqlDataReader = cmd_ull.ExecuteReader()
Line 132:  
Line 133:  			If reader_ull.Read()
Line 134:  				Dim country, region, city, zip, location As String, lat, lng As Decimal
Line 135:  
Line 136:  				country = reader_ull("Country").ToString()
Line 137:  				region = reader_ull("Region").ToString()
Line 138:  				city = reader_ull("City").ToString()
Line 139:  				zip = reader_ull("Zip").ToString()
Line 140:  				lat = reader_ull("Latitude").ToString()
Line 141:  				lng = reader_ull("Longitude").ToString()
Line 142:  
Line 143:  				If lat <> 0 And lng <> 0
Line 144:  					If country = "United States" Or country = "Canada"
Line 145:  						If region <> "" And city <> ""
Line 146:  							location = city & ", " & region
Line 147:  						ElseIf region <> ""
Line 148:  							location = region & ", " & country
Line 149:  						End If
Line 150:  
Line 151:  						lat = reader_ull("Latitude")
Line 152:  						lng = reader_ull("Longitude")
Line 153:  					Else
Line 154:  						If city <> "" And country <> ""
Line 155:  							If region <> ""
Line 156:  								location = city & ", " & region & ", " & country
Line 157:  							Else
Line 158:  								location = city & ", " & country
Line 159:  							End If
Line 160:  						End If
Line 161:  					End If
Line 162:  
Line 163:  					If location <> ""
Line 164:  						Response.Cookies("Latitude").Expires=Today.AddDays(40)
Line 165:  						Response.Cookies("Latitude").Value=lat
Line 166:  						userLat = lat
Line 167:  
Line 168:  						Response.Cookies("Longitude").Expires=Today.AddDays(40)
Line 169:  						Response.Cookies("Longitude").Value=lng
Line 170:  						userLng = lng
Line 171:  
Line 172:  						Response.Cookies("Location").Expires=Today.AddDays(40)
Line 173:  						Response.Cookies("Location").Value=location.Replace(" ", "_")
Line 174:  						userLocation = location
Line 175:  					End If
Line 176:  				End If
Line 177:  			End If
Line 178:  
Line 179:  			reader_ull.Close() : cmd_ull.Dispose() : conn_ull.Close() : conn_ull.Dispose()
Line 180:  		End If
Line 181:  	End If
Line 182:  
Line 183:  	''//userLat = 38.631034
Line 184:  	''//userLng = -90.1931066
Line 185:  	''//userLocation = "Saint Louis, MO"
Line 186:  
Line 187:  	If userLocation = ""
Line 188:  		userLocation = "Edit Location"
Line 189:  	Else
Line 190:  		If userLocation.IndexOf(",") > -1
Line 191:  			userLocationCity = userLocation.SubString(0, userLocation.IndexOf(","))
Line 192:  			userLocationState = userLocation.SubString(userLocation.IndexOf(","))
Line 193:  			userLocationState = userLocationState.Trim(",")
Line 194:  			userLocationState = userLocationState.Trim()
Line 195:  		End If
Line 196:  	End If
Line 197:  End Sub
Line 198:  
Line 199:  Function GetLocationByIp(ByVal ip As String) As String
Line 200:  	Dim location As String = ""
Line 201:  	
Line 202:  	If IsBot() = False
Line 203:  		Dim ipArray() As String = ip.Split(".")
Line 204:  		Dim locationValue As Int64, z As Int32, invalidLocation As Boolean
Line 205:  
Line 206:  		For Each i As String In ipArray
Line 207:  			If Not IsNumeric(i)
Line 208:  				Exit For
Line 209:  			End If
Line 210:  
Line 211:  			z += 1
Line 212:  
Line 213:  			Select Case z
Line 214:  				Case 1
Line 215:  					locationValue = Convert.ToInt64(i) * 16777216
Line 216:  				Case 2
Line 217:  					locationValue += Convert.ToInt64(i) * 65536
Line 218:  				Case 3
Line 219:  					''//locationValue += Convert.ToInt64(i) * 97
Line 220:  					locationValue += Convert.ToInt64(i) * 256
Line 221:  				Case 4
Line 222:  					locationValue += Convert.ToInt64(i)
Line 223:  				Case Else
Line 224:  					invalidLocation = True
Line 225:  					Exit For
Line 226:  			End Select
Line 227:  		Next
Line 228:  
Line 229:  		If locationValue > 0 And invalidLocation = False
Line 230:  			Dim strSQL_ull As String="SELECT L.CountryName AS Country, L.SubDivision1IsoCode AS Region, L.CityName AS City, B.PostalCode AS Zip, B.Latitude, B.Longitude " & _
Line 231:  				"FROM GeoIP2Blocks B " & _
Line 232:  				"INNER JOIN GeoIP2Locations L ON L.GeoNameID = B.GeoNameID " & _
Line 233:  				"WHERE (" & locationValue & " BETWEEN B.NetworkStartInteger AND B.NetworkLastInteger) AND (L.CityName <> '')"
Line 234:  
Line 235:  			Dim objConn_ull As New SqlConnection(Application("ConnectionStringReadOnly"))
Line 236:  			Dim objCmd_ull As New SqlCommand(strSQL_ull, objConn_ull)
Line 237:  
Line 238:  			objConn_ull.Open()
Line 239:  
Line 240:  			Dim objR_ull As SqlDataReader=objCmd_ull.ExecuteReader()
Line 241:  
Line 242:  			If objR_ull.Read()
Line 243:  				Dim country, region, city, zip As String, lat, lng As Decimal
Line 244:  
Line 245:  				country = objR_ull("Country").ToString()
Line 246:  				region = objR_ull("Region").ToString()
Line 247:  				city = objR_ull("City").ToString()
Line 248:  				zip = objR_ull("Zip").ToString()
Line 249:  				lat = objR_ull("Latitude").ToString()
Line 250:  				lng = objR_ull("Longitude").ToString()
Line 251:  
Line 252:  				If lat <> 0 And lng <> 0
Line 253:  					If country = "United States" Or country = "Canada"
Line 254:  						If region <> "" And city <> ""
Line 255:  							location = city & ", " & region
Line 256:  						ElseIf region <> ""
Line 257:  							location = region & ", " & country
Line 258:  						End If
Line 259:  
Line 260:  						lat = objR_ull("Latitude")
Line 261:  						lng = objR_ull("Longitude")
Line 262:  					Else
Line 263:  						If city <> "" And country <> ""
Line 264:  							If region <> ""
Line 265:  								location = city & ", " & region & ", " & country
Line 266:  							Else
Line 267:  								location = city & ", " & country
Line 268:  							End If
Line 269:  						End If
Line 270:  					End If
Line 271:  				End If
Line 272:  			End If
Line 273:  
Line 274:  			objR_ull.Close() : objCmd_ull.Dispose() : objConn_ull.Close() : objConn_ull.Dispose()
Line 275:  		End If
Line 276:  	End If
Line 277:  
Line 278:  	Return(location)
Line 279:  End Function
Line 280:  
Line 281:  Function reviewStars(ByVal score As Single) As String
Line 282:  	Select Case score
Line 283:  		Case >= 4.75
Line 284:  			Return("<i class=""fa fa-star""></i><i class=""fa fa-star""></i><i class=""fa fa-star""></i><i class=""fa fa-star""></i><i class=""fa fa-star""></i>")
Line 285:  		Case >= 4.25
Line 286:  			Return("<i class=""fa fa-star""></i><i class=""fa fa-star""></i><i class=""fa fa-star""></i><i class=""fa fa-star""></i><i class=""fa fa-star-half-o""></i>")
Line 287:  		Case >= 3.75
Line 288:  			Return("<i class=""fa fa-star""></i><i class=""fa fa-star""></i><i class=""fa fa-star""></i><i class=""fa fa-star""></i><i class=""fa fa-star-o""></i>")
Line 289:  		Case >= 3.25
Line 290:  			Return("<i class=""fa fa-star""></i><i class=""fa fa-star""></i><i class=""fa fa-star""></i><i class=""fa fa-star-half-o""></i><i class=""fa fa-star-o""></i>")
Line 291:  		Case >= 2.75
Line 292:  			Return("<i class=""fa fa-star""></i><i class=""fa fa-star""></i><i class=""fa fa-star""></i><i class=""fa fa-star-o""></i><i class=""fa fa-star-o""></i>")
Line 293:  		Case >= 2.25
Line 294:  			Return("<i class=""fa fa-star""></i><i class=""fa fa-star""></i><i class=""fa fa-star-half-o""></i><i class=""fa fa-star-o""></i><i class=""fa fa-star-o""></i>")
Line 295:  		Case >= 1.75
Line 296:  			Return("<i class=""fa fa-star""></i><i class=""fa fa-star""></i><i class=""fa fa-star-o""></i><i class=""fa fa-star-o""></i><i class=""fa fa-star-o""></i>")
Line 297:  		Case >= 1.25
Line 298:  			Return("<i class=""fa fa-star""></i><i class=""fa fa-star-half-o""></i><i class=""fa fa-star-o""></i><i class=""fa fa-star-o""></i><i class=""fa fa-star-o""></i>")
Line 299:  		Case >= .75
Line 300:  			Return("<i class=""fa fa-star""></i><i class=""fa fa-star-o""></i><i class=""fa fa-star-o""></i><i class=""fa fa-star-o""></i><i class=""fa fa-star-o""></i>")
Line 301:  		Case >= .25
Line 302:  			Return("<i class=""fa fa-star-half-o""></i><i class=""fa fa-star-o""></i><i class=""fa fa-star-o""></i><i class=""fa fa-star-o""></i><i class=""fa fa-star-o""></i>")
Line 303:  		Case Else
Line 304:  			Return("<i class=""fa fa-star-o""></i><i class=""fa fa-star-o""></i><i class=""fa fa-star-o""></i><i class=""fa fa-star-o""></i><i class=""fa fa-star-o""></i>")
Line 305:  	End Select
Line 306:  End Function
Line 307:  
Line 308:  Function IsKnownBot() As Boolean
Line 309:  	Dim strRobotsArray As String() = {"bingbot", "googlebot", "uptimerobot", "blexbot", "testomatobot", "yandex", "baidu", "pingoscope", "mj12bot", "exabot", _
Line 310:  		"omgilibot", "dotbot", "ccbot", "ahrefsbot", "archive.org", "special_archiver", "slurp", "linkdexbot", "seznambot", "psbot", "seokicks", "yeti", _
Line 311:  		"coccoc", "metajobbot", "superarama", "changedetection", "msnbot", "domainappender", "lipperhey", "vagabondo", "woko", "thumbsniper", "mail.ru", _
Line 312:  		"ichiro", "sogou", "gigablast", "360spider", "smtbot", "obot", "netsteer", "proximic", "zumbot", "sitedomain-bot", "mojeek", "searchmetrics", _
Line 313:  		"genieo", "sentibot", "openlinkprofiler", "james bot", "spinn3r", "wesee", "wevika", "semrush", "applebot", "daumoa", "deadlinkchecker", _
Line 314:  		"tools4noobs", "web-sniffer", "motoricerca", "robots_tester", "promotion_tools", "whatsmyip", "meanpathbot", "secretsearchenginelabs", "gimme", _
Line 315:  		"yooz", "grapeshot", "w3dt", "wotbox", "voltron", "expertsearch", "orangebot", "voilabot", "orangecrawler", "mindup", "stq_bot", "blekkobot", _
Line 316:  		"seodiver", "riddler", "speedy spider", "sputnikbot", "cliqzbot", "nalezen", "seocheck", "tagseobot", "aihit", "chlooe", "coincorner", "netestate", _
Line 317:  		"producto", "flipboard", "steeler", "kraken", "rogerbot", "showyou", "bitlybot", "gtmetrix", "icjobs", "comodo", "wi job", "megaindex", "jyxobot", _
Line 318:  		"linkapedia", "zeerch", "xovibot", "idmarch", "bad-neighborhood", "antbot", "semanticscholar", "linkmarket", "rankflex", "bdcbot", "wbsrch", _
Line 319:  		"link valet", "page valet", "dlcbot", "online domain tools", "kumkie", "crawler4j", "bcklinks", "web-sniffer", "404 checker", "lcc", "heritrix", _
Line 320:  		"yacybot", "alexabot", "alexa site audit", "heartrails", "geturlinfo", "facebookexternalhit", "aboundex", "pagespeed", "yioop", "govid.mobi", _
Line 321:  		"panscient", "duckduckgo", "duckduckbot", "netcraftsurvey", "plukkie", "backlinkcrawler", "woriobot", "semantic-visions", "wbsearchbot", _
Line 322:  		"gluten free crawler", "turnitinbot", "umbot-fc", "umbot-ln", "linktiger", "spiderling", "2bone_link", "powermapper", "brokenlinkcheck", "zoominfo", _
Line 323:  		"nextgensearchbot", "bubing", "implisensebot", "experibot", "uaslinkchecker", "thumbshots", "apercite", "webmastercoffee", "waseda", "exactseek", _
Line 324:  		"007ac9", "tweetmemebot", "impressumscrawler", "vorboss", "seograph", "safesearch microdata", "safesearch.avira.com", "mixbot", "parsijoo", _
Line 325:  		"easou", "r6_comment", "r6_feed", "domaintuno", "worldbrewbot", "seobility", "urlstat", "integromedb", "port-monitor.com", "port monitor check service", _
Line 326:  		"kimonolabs", "icc-crawler", "loadimpact", "websnapr", "cukbot", "memorybot", "qwantify", "trendiction", "natlib.gov", "uptimedog", "gecko webthumb", _
Line 327:  		"linkpeek", "hosttracker", "ia_archiver", "bdfetch", "metaspider", "site24x7", "it2media", "pandeo", "agentslug.com", "siteliner", "sistrix", _
Line 328:  		"mnogosearch", "aboutusbot", "jobdiggerspider", "istellabot", "sukibot", "hubspot", "optimizationcrawler", "abrave v", "abrave spider", "leikibot", _
Line 329:  		"gozaikbot", "botlink", "ahoy!", "alkalinebot", "anthillv", "appie/", "arachnophilia", "araneo", "araybOt", "architextspider", "ariadne", "arks/", _
Line 330:  		"aspider/", "atn_worldwide", "atomz/", "auresys/", "backrub/", "bayspider", "bbot/", "big brother", "bjaaland/", "blackwidow", "die blinde kuh", _
Line 331:  		"ukonline", "borg-bot/", "boxseabot/", "bspider/", "cactvs", "calif/", "digimarc", "checkbot/", "christcrawler", "cienciaficcion", "cmc/", _
Line 332:  		"conceptbot/", "confuzzledbot/", "coolbot", "cosmos/", "internet cruiser robot", "cusco/", "cyberspyder/", "cydralspider/", "desertrealm", "deweb/", _
Line 333:  		"dienstspider/1.0", "digger/", "diibot", "grabber", "dnabot/", "dragonbot/", "dwcp/", "lwp:", "ebiness", "eit-link-verifier", "elfinbot", "emacs-", _
Line 334:  		"emc spider", "esculapio", "evliya celebi", "explorersearch", "fastcrawler", "fdse robot", "felixide", "hazel's ferret", "esirover", "fido/", _
Line 335:  		"hämähäkki/", "kit-fireball", "fish-search", "fouineur", "robot du crim", "freecrawl", "funnelweb-", "gammaspider", "gazz/", "gcreep/", "geturl.rexx", _
Line 336:  		"golem/", "griffon/", "gromit/", "gulliver/", "gulper web bot", "havindex/", "aitcsrobot/", "hometown spider pro", "wired-digital-newsbot/", _
Line 337:  		"htdig/", "htmlgobble", "iajaBot/", "ibm_planetwide", "gestalticonoclast", "ingrid/", "incywincy", "infoseek", "infospiders/", "inspectorwww/", _
Line 338:  		"iron33/", "israelisearch/", "javabee", "jcrawler/", "ask jeeves", "jobot/", "joebot/", "jubiirobot", "jumpstation", "image.kapsi.net", "katipo/", _
Line 339:  		"kdd-explorer/", "ko_yappo_robot", "labelgrab/", "larbin (+mail)", "linkidator/", "linkscan server", "Linkwalker", "lockon/", "logo.gif crawler", _
Line 340:  		"lycos/", "magpie/", "marvin/infoseek", "mediafox/", "merzscope", "nec-meshexplorer", "mindcrawler", "udmsearch", "moget/", "momspider/", "muninn/", _
Line 341:  		"muscatferret", "mwdsearch/", "sharp-info-agent", "ndspider/", "etcarta cyberpilot", "netmechanic", "netscoop/", "newscan-online/", "nhsewalker/", _
Line 342:  		"nomad-v", "objectssearch/", "occam/", "hku www robot", "ontospider/", "openbot", "orbsearch", "packrat/", "pageboy/", "parasite/", "patric/", _
Line 343:  		"web robot pegasus", "peregrinator-mathematics", "perlcrawler", "duppies", "phpdig", "piltdownman", "pimptrain", "portaljuice.com", "pgp-ka/", _
Line 344:  		"plumtreewebaccessor", "poppi/", "portalbspider/", "psbot/", "getterroboplus", "raven-v", "resume robot", "rhcs/", "rixbot", "imagescape robot", _
Line 345:  		"robbie/", "computingsite robi", "robocrawl (", "robofox v", "robozilla/", "roverbot", "safetynet robot", "scooter/", "sleek spider", _
Line 346:  		"searchprocess/", "senrigan/", "sg-scout", "shagseeker", "shai'hulud", "libwww-perl-", "simbot/", "site valet", "open text site crawler", _
Line 347:  		"sitetech-rover", "awapclient", "slcrawler", "esismartspider", "snooper/", "solbot/", "spanner/", "speedy spider", "mouse.house/", "spiderbot/", _
Line 348:  		"spiderline/", "spiderview", "ssearcher100", "suke/", "suntek/", "sygol.com", "black widow v", "tarantula/", "tarspider", "dlw3robot/", "techbot", _
Line 349:  		"templeton/", "teoma_agent1", "titin/", "titan/", "tlspider/", "ucsd-crawler", "udmsearch/", "uptimebot", "urlck/", "url spider pro", "valkyrie/", _
Line 350:  		"verticrawlbot", "victoria/", "vision-search/", "void-bot/", "vwbot_k", "w3index", "w3m2/", "crawlpaper/", "wwwanderer v", "w@pspider/", _
Line 351:  		"webbandit/", "webcatcher/", "webcopy/", "webfetcher/", "weblayers/", "weblinker/", "webmoose/", "webquest/", "digimarc webreader/", "webreaper", _
Line 352:  		"webs@recruit.co.jp", "webvac/", "webwalk", "webwalker/", "wget/", "whatuseek_winona", "wlm-", "w3mir", "wolp/", "wwwc/", "nederland.zoek", _
Line 353:  		"montastic", "majestic12", "nerdybot", "python-urllib", "tbot-nutch", "twitterbot", "domainreanimator", _
Line 354:  		"yisouspider", "linkwalker", "google favicon", "scrapy.org", "paperlibot", "phpcrawl", "pinterest", _
Line 355:  		"python-urllib/2.7", "feedfetcher-google", "netlyzer", "python-requests", "google-site-verification", _
Line 356:  		"semanticbot", "siteexplorer.info", "linkpadbot/", "businessbot:", "weborama-fetcher", "go-http-client/", "stratagems kumo", "betabot", _
Line 357:  		"linguee bot", "seoscanners", "findxbot", "bomborabot", "15miles.com", "ips-agent", "dataprovider.com", "extlinksbot", "toweya", "ltx71", _
Line 358:  		"code.google.com/appengine; appid: s~snapchat-proxy)", "safednsbot", "pcore-http", "8legs", "redback/", "saleslift", "daum/", "headmasterseo", _
Line 359:  		"metauri.com", "sitelockspider", "domainstatsbot", "id-search.xyz", "gookey.co/", "xenu link sleuth", "uipbot/", "scoutjet.com", _
Line 360:  		"techinfo@ubermetrics-technologies.com", "catexplorador", "datagnionbot", "peet browser", "blackboard safeassign", "/nutch-", "rankingbot2", _
Line 361:  		"linkfluence.com", "www-mechanize/", "zibalinks", "wonderbot/", "teeraidbot", "xml-sitemaps.com", "okhttp/", "screaming frog", "smurlexpander", _
Line 362:  		"go 1.1 package http", "client/research_scan", "checkmarknetwork", "superpagesurlverifybot", "; linkcheckv", "scrapy-redis", "faraday v", _
Line 363:  		"www.x9o.de", "nettrack.info", "veoozbot", "seozoom", "s~buzzstream-tools-hrd", "redirector/1.1", "github.com/aliasio/wappalyzer", _
Line 364:  		"thunderstone.com", "g-i-g-a-b-o-t", "seoterritory.com", "feedparser.org", "salesintelligent", "licvb.wpengine.com", _
Line 365:  		"dnyzbot/", "watson-url-fetcher", "clickagy intelligence bot", "gowikibot/", "pipl.com", "barkrowler", "buff library user agent", "rssingbot", _
Line 366:  		"mediapartners-google", "node-urllib", "guzzlehttp", "symfony browserkit", "a6-indexer", "sirdatabot", _
Line 367:  		"superfeedr bot/", "jersey/2.25.1 (apache httpclient 4.5)", "python/3.6 aiohttp/", "software.schmorp.de/", _
Line 368:  		"http://researchscan.comsys.rwth-aachen.de)", "mozilla/3.0 (compatible; indy library)", "ahc/2.1", _
Line 369:  		"nimbostratus-bot/v", "apache-httpclient/", "zgrab/", "industryindexbot/", "libcurl/", "wappalyzer", _
Line 370:  		"sitechecker", "surdotlybot/", "urltester/", "webdatastats/", "mainwp/", "leadssearchspider", "v-bot/", "honeybee ver. ", "b2b bot", _
Line 371:  		"trendsmapresolver/", "gigabot", "winhttp.winhttprequest.", "spuhex.com", "universalfeedparser/", "dcrawl/", "prlog.ru", "tracemyfile/", _
Line 372:  		"econtext/", "voluumdsp-content-bot/", "httpscheck (", "opebot (", "sitetruth.com", "hybridbot", "re-re studio", "grammarly/", _
Line 373:  		"28logsspider", "bot annuairefrancais.", "ocarinabot", "newspaper/0", "redditbot/", "mappy/", "dispatch/0", "lookseek.com", _
Line 374:  		"tweetedtimes.com", "orgprobe/", "com.plumanalytics", "easybib autocite", "cakephp", "mediatoolkitbot", "jooblebot", "adsbot-google", _
Line 375:  		"wordpress/", "dispatch/", "mixnodecache/", "evc-batch/2.0)", "woorankreview/", "everyonedomainsbot/", "tweezler/", "di-cloud-parser", _
Line 376:  		"acebookexternalhit/", "node-fetch/", "deeris/", "react/alpha", "outclicksbot/", "httpclient/1.", "bublupbot", "thither.direct bot/", _
Line 377:  		"serpstatbot/", "jdatabasedrivermysqli", "vuhuvbot/", "pandalytics/", "who.is bot", "dun&bradstreetbot/", "coraxcyber.com", "node-superagent/", _
Line 378:  		"reqwest/", "bublup.com", "7siters/", "crowdtanglebot/", "my user agent name", "chimebot", "pleskbot", "cloudfind/", "scrapybot (", "clarabot/", _
Line 379:  		"awariosmartbot/", "sjuupbot", "linkedinbot/", "brands-bot", "adsbot/)", "bananabot/", "aspiegelbot)", "keybot translation", "jetmon/", _
Line 380:  		"centuryb.o.t", "turnitin (", "research-project-bot", "linespider/", "bitdiscovery", "myseosnapshot/", "axios/", "yelpbot", "hotbot", _
Line 381:  		"go http package", "phpwebsite/", "rustbot/", "hexometer", "niuebot/", " adsbot/", "hypefactors.com", "admantx", "domainsproject.org", _
Line 382:  		"censys.io", "htmlparser/", "intelx.io_bot", "embarcadero", "webtech/", "polyapp-website-analysis"}
Line 383:  	
Line 384:  	Dim strFilterUserAgent As String = (Request.ServerVariables("HTTP_USER_AGENT") & "").ToLower()
Line 385:  
Line 386:  	Dim blnIsARobot As Boolean = False
Line 387:  
Line 388:  	If strFilterUserAgent=Nothing Then blnIsARobot = True
Line 389:  
Line 390:  	Dim i_robot As String
Line 391:  
Line 392:  	If strFilterUserAgent <> ""
Line 393:  		If strFilterUserAgent.Length > 5
Line 394:  			If strFilterUserAgent.SubString(0, 5) = "java/" Or strFilterUserAgent.SubString(0, 5) = "curl/"
Line 395:  				blnIsARobot = True
Line 396:  			End If
Line 397:  		End If
Line 398:  	End If
Line 399:  
Line 400:  	If strFilterUserAgent = "null" Or strFilterUserAgent = "foo" Or strFilterUserAgent = "ruby" Or strFilterUserAgent = "mozilla/5.0 (compatible; optimizer)" Or strFilterUserAgent = "n/a"
Line 401:  		blnIsARobot = True
Line 402:  	Else
Line 403:  		For Each i_robot In strRobotsArray
Line 404:  			If strFilterUserAgent.IndexOf(i_robot) > -1
Line 405:  				blnIsARobot = True
Line 406:  				Exit For
Line 407:  			End If
Line 408:  		Next
Line 409:  	End If
Line 410:  
Line 411:  	Return(blnIsARobot)
Line 412:  End Function
Line 413:  
Line 414:  Function IsBot() As Boolean
Line 415:  	Dim objBrowserCaps As System.Web.HttpBrowserCapabilities = Request.Browser
Line 416:  	Dim blnIsBot As Boolean = (CType(objBrowserCaps, System.Web.Configuration.HttpCapabilitiesBase)).Crawler 
Line 417:  
Line 418:  	If blnIsBot = False
Line 419:  		Dim blnIsBot2 As Boolean = IsKnownBot()
Line 420:  		
Line 421:  		If blnIsBot2 Then blnIsBot = True
Line 422:  	End If
Line 423:  
Line 424:  	If Not blnIsBot
Line 425:  		Dim uA As String = (Request.ServerVariables("HTTP_USER_AGENT") & "").ToLower()
Line 426:  
Line 427:  		If uA.IndexOf("windows")=-1 And uA.IndexOf("applewebkit")=-1 And uA.IndexOf("thunderbird/")=-1 And uA.IndexOf("applewebkit")=-1 And uA.IndexOf("thunderbird/")=-1 And uA.IndexOf("msie")=-1 And uA.IndexOf("opera")=-1 And uA.IndexOf("safari")=-1 And uA.IndexOf("android")=-1 And uA.IndexOf("firefox")=-1 And uA.IndexOf("chrome")=-1 And uA.IndexOf("iphone")=-1
Line 428:  			If uA.Length > 100 Then uA = uA.SubString(0, 99)
Line 429:  			''//ExecNonQuery("INSERT INTO UserAgents(Agent, IP) VALUES('" & uA.Replace("'", "''") & "', '" & Request.ServerVariables("REMOTE_ADDR") & "')")
Line 430:  		End If
Line 431:  	End If
Line 432:  
Line 433:  	Return(blnIsBot)
Line 434:  End Function
Line 435:  
Line 436:  Function ExecScalar(ByVal strQuery As String) As String
Line 437:  	If strQuery.Length>0
Line 438:  		Dim objConn As New SqlConnection(Application("ConnectionString"))
Line 439:  		Dim objCmd As New SqlCommand(strQuery, objConn)
Line 440:  
Line 441:  		objConn.Open()
Line 442:  
Line 443:  		Dim strResult As String=objCmd.ExecuteScalar()
Line 444:  
Line 445:  		objCmd.Dispose() : objConn.Close() : objConn.Dispose()
Line 446:  
Line 447:  		Return strResult
Line 448:  	Else
Line 449:  		Return Nothing
Line 450:  	End If
Line 451:  End Function
Line 452:  
Line 453:  Sub ExecNonQuery(ByVal strQuery As String)
Line 454:  	If strQuery.Length>0
Line 455:  		Dim objConn As New SqlConnection(Application("ConnectionString"))
Line 456:  		Dim objCmd As New SqlCommand(strQuery, objConn)
Line 457:  
Line 458:  		objConn.Open() : objCmd.ExecuteNonQuery()
Line 459:  
Line 460:  		objCmd.Dispose() : objConn.Close() : objConn.Dispose()
Line 461:  	End If
Line 462:  End Sub
Line 463:  
Line 464:  Function F(ByVal strF As String) As String
Line 465:  	If Request(strF)=Nothing
Line 466:  		Return("'', ")
Line 467:  	Else
Line 468:  		Return("'" & Request(strF).ToString().Replace("'", "''") & "', ")
Line 469:  	End If
Line 470:  End Function
Line 471:  
Line 472:  Function F2(ByVal strF As String) As String
Line 473:  	If Request(strF)=Nothing
Line 474:  		Return("''")
Line 475:  	Else
Line 476:  		Return("'" & Request(strF).ToString().Replace("'", "''") & "'")
Line 477:  	End If
Line 478:  End Function
Line 479:  
Line 480:  Function stripHtml(ByVal Y As String) As String
Line 481:  	Dim R As RegEx
Line 482:  	
Line 483:  	If Y = Nothing Then Return("")
Line 484:  
Line 485:  	Y=R.Replace(Y, "<[^>]*(>|$)", "")
Line 486:  
Line 487:  	Return(Y)
Line 488:  End Function
Line 489:  
Line 490:  Function getStateSmall(ByVal strState As String)
Line 491:  	Select Case (strState & "").ToLower()
Line 492:  		Case "alabama"
Line 493:  			Return("AL")
Line 494:  		Case "alaska"
Line 495:  			Return("AK")
Line 496:  		Case "arizona"
Line 497:  			Return("AZ")
Line 498:  		Case "arkansas"
Line 499:  			Return("AR")
Line 500:  		Case "california"
Line 501:  			Return("CA")
Line 502:  		Case "colorado"
Line 503:  			Return("CO")
Line 504:  		Case "connecticut"
Line 505:  			Return("CT")
Line 506:  		Case "delaware"
Line 507:  			Return("DE")
Line 508:  		Case "district of columbia", "district-of-columbia"
Line 509:  			Return("DC")
Line 510:  		Case "florida"
Line 511:  			Return("FL")
Line 512:  		Case "georgia"
Line 513:  			Return("GA")
Line 514:  		Case "hawaii"
Line 515:  			Return("HI")
Line 516:  		Case "idaho"
Line 517:  			Return("ID")
Line 518:  		Case "illinois"
Line 519:  			Return("IL")
Line 520:  		Case "indiana"
Line 521:  			Return("IN")
Line 522:  		Case "iowa"
Line 523:  			Return("IA")
Line 524:  		Case "kansas"
Line 525:  			Return("KS")
Line 526:  		Case "kentucky"
Line 527:  			Return("KY")
Line 528:  		Case "louisiana"
Line 529:  			Return("LA")
Line 530:  		Case "maine"
Line 531:  			Return("ME")
Line 532:  		Case "maryland"
Line 533:  			Return("MD")
Line 534:  		Case "massachusetts"
Line 535:  			Return("MA")
Line 536:  		Case "michigan"
Line 537:  			Return("MI")
Line 538:  		Case "minnesota"
Line 539:  			Return("MN")
Line 540:  		Case "mississippi"
Line 541:  			Return("MS")
Line 542:  		Case "missouri"
Line 543:  			Return("MO")
Line 544:  		Case "montana"
Line 545:  			Return("MT")
Line 546:  		Case "nebraska"
Line 547:  			Return("NE")
Line 548:  		Case "nevada"
Line 549:  			Return("NV")
Line 550:  		Case "new hampshire", "new-hampshire"
Line 551:  			Return("NH")
Line 552:  		Case "new jersey", "new-jersey"
Line 553:  			Return("NJ")
Line 554:  		Case "new mexico", "new-mexico"
Line 555:  			Return("NM")
Line 556:  		Case "new york", "new-york"
Line 557:  			Return("NY")
Line 558:  		Case "north carolina", "north-carolina"
Line 559:  			Return("NC")
Line 560:  		Case "north dakota", "north-dakota"
Line 561:  			Return("ND")
Line 562:  		Case "ohio"
Line 563:  			Return("OH")
Line 564:  		Case "oklahoma"
Line 565:  			Return("OK")
Line 566:  		Case "oregon"
Line 567:  			Return("OR")
Line 568:  		Case "pennsylvania"
Line 569:  			Return("PA")
Line 570:  		Case "puerto rico", "puerto-rico"
Line 571:  			Return("PR")
Line 572:  		Case "rhode island", "rhode-island"
Line 573:  			Return("RI")
Line 574:  		Case "south carolina", "south-carolina"
Line 575:  			Return("SC")
Line 576:  		Case "south dakota", "south-dakota"
Line 577:  			Return("SD")
Line 578:  		Case "tennessee"
Line 579:  			Return("TN")
Line 580:  		Case "texas"
Line 581:  			Return("TX")
Line 582:  		Case "utah"
Line 583:  			Return("UT")
Line 584:  		Case "vermont"
Line 585:  			Return("VT")
Line 586:  		Case "virginia"
Line 587:  			Return("VA")
Line 588:  		Case "washington"
Line 589:  			Return("WA")
Line 590:  		Case "west virginia", "west-virginia"
Line 591:  			Return("WV")
Line 592:  		Case "wisconsin"
Line 593:  			Return("WI")
Line 594:  		Case "wyoming"
Line 595:  			Return("WY")
Line 596:  		Case "alberta"
Line 597:  			Return("AB")
Line 598:  		Case "british-columbia"
Line 599:  			Return("BC")
Line 600:  		Case "manitoba"
Line 601:  			Return("MB")
Line 602:  		Case "new-brunswick"
Line 603:  			Return("NB")
Line 604:  		Case "newfoundland", "newfoundland-and-labrador"
Line 605:  			Return("NL")
Line 606:  		Case "nova-scotia"
Line 607:  			Return("NS")
Line 608:  		Case "northwest-territories"
Line 609:  			Return("NT")
Line 610:  		Case "nunavut"
Line 611:  			Return("NU")
Line 612:  		Case "ontario"
Line 613:  			Return("ON")
Line 614:  		Case "prince-edward-island"
Line 615:  			Return("PE")
Line 616:  		Case "quebec"
Line 617:  			Return("QC")
Line 618:  		Case "saskatchewan"
Line 619:  			Return("SK")
Line 620:  		Case "yukon"
Line 621:  			Return("YT")
Line 622:  		Case Else
Line 623:  			Return("")
Line 624:  	End Select
Line 625:  End Function
Line 626:  
Line 627:  Function getStatePath(ByVal strState As String)
Line 628:  	Select Case (strState & "").ToUpper()
Line 629:  		Case "AL"
Line 630:  			Return("alabama")
Line 631:  		Case "AK"
Line 632:  			Return("alaska")
Line 633:  		Case "AZ"
Line 634:  			Return("arizona")
Line 635:  		Case "AR"
Line 636:  			Return("arkansas")
Line 637:  		Case "CA"
Line 638:  			Return("california")
Line 639:  		Case "CO"
Line 640:  			Return("colorado")
Line 641:  		Case "CT"
Line 642:  			Return("connecticut")
Line 643:  		Case "DE"
Line 644:  			Return("delaware")
Line 645:  		Case "DC"
Line 646:  			Return("district-of-columbia")
Line 647:  		Case "FL"
Line 648:  			Return("florida")
Line 649:  		Case "GA"
Line 650:  			Return("georgia")
Line 651:  		Case "HI"
Line 652:  			Return("hawaii")
Line 653:  		Case "ID"
Line 654:  			Return("idaho")
Line 655:  		Case "IL"
Line 656:  			Return("illinois")
Line 657:  		Case "IN"
Line 658:  			Return("indiana")
Line 659:  		Case "IA"
Line 660:  			Return("iowa")
Line 661:  		Case "KS"
Line 662:  			Return("kansas")
Line 663:  		Case "KY"
Line 664:  			Return("kentucky")
Line 665:  		Case "LA"
Line 666:  			Return("louisiana")
Line 667:  		Case "ME"
Line 668:  			Return("maine")
Line 669:  		Case "MD"
Line 670:  			Return("maryland")
Line 671:  		Case "MA"
Line 672:  			Return("massachusetts")
Line 673:  		Case "MI"
Line 674:  			Return("michigan")
Line 675:  		Case "MN"
Line 676:  			Return("minnesota")
Line 677:  		Case "MS"
Line 678:  			Return("mississippi")
Line 679:  		Case "MO"
Line 680:  			Return("missouri")
Line 681:  		Case "MT"
Line 682:  			Return("montana")
Line 683:  		Case "NE"
Line 684:  			Return("nebraska")
Line 685:  		Case "NV"
Line 686:  			Return("nevada")
Line 687:  		Case "NH"
Line 688:  			Return("new-hampshire")
Line 689:  		Case "NJ"
Line 690:  			Return("new-jersey")
Line 691:  		Case "NM"
Line 692:  			Return("new-mexico")
Line 693:  		Case "NY"
Line 694:  			Return("new-york")
Line 695:  		Case "NC"
Line 696:  			Return("north-carolina")
Line 697:  		Case "ND"
Line 698:  			Return("north-dakota")
Line 699:  		Case "OH"
Line 700:  			Return("ohio")
Line 701:  		Case "OK"
Line 702:  			Return("oklahoma")
Line 703:  		Case "OR"
Line 704:  			Return("oregon")
Line 705:  		Case "PA"
Line 706:  			Return("pennsylvania")
Line 707:  		Case "PR"
Line 708:  			Return("puerto-rico")
Line 709:  		Case "RI"
Line 710:  			Return("rhode-island")
Line 711:  		Case "SC"
Line 712:  			Return("south-carolina")
Line 713:  		Case "SD"
Line 714:  			Return("south-dakota")
Line 715:  		Case "TN"
Line 716:  			Return("tennessee")
Line 717:  		Case "TX"
Line 718:  			Return("texas")
Line 719:  		Case "UT"
Line 720:  			Return("utah")
Line 721:  		Case "VT"
Line 722:  			Return("vermont")
Line 723:  		Case "VA"
Line 724:  			Return("virginia")
Line 725:  		Case "WA"
Line 726:  			Return("washington")
Line 727:  		Case "WV"
Line 728:  			Return("west-virginia")
Line 729:  		Case "WI"
Line 730:  			Return("wisconsin")
Line 731:  		Case "WY"
Line 732:  			Return("wyoming")
Line 733:  		Case "AB"
Line 734:  			Return("alberta")
Line 735:  		Case "BC"
Line 736:  			Return("british-columbia")
Line 737:  		Case "MB"
Line 738:  			Return("manitoba")
Line 739:  		Case "NB"
Line 740:  			Return("new-brunswick")
Line 741:  		Case "NL"
Line 742:  			Return("newfoundland")
Line 743:  		Case "NS"
Line 744:  			Return("nova-scotia")
Line 745:  		Case "NT"
Line 746:  			Return("northwest-territories")
Line 747:  		Case "NU"
Line 748:  			Return("nunavut")
Line 749:  		Case "ON"
Line 750:  			Return("ontario")
Line 751:  		Case "PE"
Line 752:  			Return("prince-edward-island")
Line 753:  		Case "QC"
Line 754:  			Return("quebec")
Line 755:  		Case "SK"
Line 756:  			Return("saskatchewan")
Line 757:  		Case "YT"
Line 758:  			Return("yukon")
Line 759:  		Case Else
Line 760:  			Return("")
Line 761:  	End Select
Line 762:  End Function
Line 763:  
Line 764:  Function getStateLarge(ByVal strState As String)
Line 765:  	Select Case (strState & "").ToUpper()
Line 766:  		Case "AL"
Line 767:  			Return("Alabama")
Line 768:  		Case "AK"
Line 769:  			Return("Alaska")
Line 770:  		Case "AZ"
Line 771:  			Return("Arizona")
Line 772:  		Case "AR"
Line 773:  			Return("Arkansas")
Line 774:  		Case "CA"
Line 775:  			Return("California")
Line 776:  		Case "CO"
Line 777:  			Return("Colorado")
Line 778:  		Case "CT"
Line 779:  			Return("Connecticut")
Line 780:  		Case "DE"
Line 781:  			Return("Delaware")
Line 782:  		Case "DC"
Line 783:  			Return("District of Columbia")
Line 784:  		Case "FL"
Line 785:  			Return("Florida")
Line 786:  		Case "GA"
Line 787:  			Return("Georgia")
Line 788:  		Case "HI"
Line 789:  			Return("Hawaii")
Line 790:  		Case "ID"
Line 791:  			Return("Idaho")
Line 792:  		Case "IL"
Line 793:  			Return("Illinois")
Line 794:  		Case "IN"
Line 795:  			Return("Indiana")
Line 796:  		Case "IA"
Line 797:  			Return("Iowa")
Line 798:  		Case "KS"
Line 799:  			Return("Kansas")
Line 800:  		Case "KY"
Line 801:  			Return("Kentucky")
Line 802:  		Case "LA"
Line 803:  			Return("Louisiana")
Line 804:  		Case "ME"
Line 805:  			Return("Maine")
Line 806:  		Case "MD"
Line 807:  			Return("Maryland")
Line 808:  		Case "MA"
Line 809:  			Return("Massachusetts")
Line 810:  		Case "MI"
Line 811:  			Return("Michigan")
Line 812:  		Case "MN"
Line 813:  			Return("Minnesota")
Line 814:  		Case "MS"
Line 815:  			Return("Mississippi")
Line 816:  		Case "MO"
Line 817:  			Return("Missouri")
Line 818:  		Case "MT"
Line 819:  			Return("Montana")
Line 820:  		Case "NE"
Line 821:  			Return("Nebraska")
Line 822:  		Case "NV"
Line 823:  			Return("Nevada")
Line 824:  		Case "NH"
Line 825:  			Return("New Hampshire")
Line 826:  		Case "NJ"
Line 827:  			Return("New Jersey")
Line 828:  		Case "NM"
Line 829:  			Return("New Mexico")
Line 830:  		Case "NY"
Line 831:  			Return("New York")
Line 832:  		Case "NC"
Line 833:  			Return("North Carolina")
Line 834:  		Case "ND"
Line 835:  			Return("North Dakota")
Line 836:  		Case "OH"
Line 837:  			Return("Ohio")
Line 838:  		Case "OK"
Line 839:  			Return("Oklahoma")
Line 840:  		Case "OR"
Line 841:  			Return("Oregon")
Line 842:  		Case "PA"
Line 843:  			Return("Pennsylvania")
Line 844:  		Case "PR"
Line 845:  			Return("Puerto Rico")
Line 846:  		Case "RI"
Line 847:  			Return("Rhode Island")
Line 848:  		Case "SC"
Line 849:  			Return("South Carolina")
Line 850:  		Case "SD"
Line 851:  			Return("South Dakota")
Line 852:  		Case "TN"
Line 853:  			Return("Tennessee")
Line 854:  		Case "TX"
Line 855:  			Return("Texas")
Line 856:  		Case "UT"
Line 857:  			Return("Utah")
Line 858:  		Case "VT"
Line 859:  			Return("Vermont")
Line 860:  		Case "VA"
Line 861:  			Return("Virginia")
Line 862:  		Case "WA"
Line 863:  			Return("Washington")
Line 864:  		Case "WV"
Line 865:  			Return("West Virginia")
Line 866:  		Case "WI"
Line 867:  			Return("Wisconsin")
Line 868:  		Case "WY"
Line 869:  			Return("Wyoming")
Line 870:  		Case "AB"
Line 871:  			Return("Alberta")
Line 872:  		Case "BC"
Line 873:  			Return("British Columbia")
Line 874:  		Case "MB"
Line 875:  			Return("Manitoba")
Line 876:  		Case "NB"
Line 877:  			Return("New Brunswick")
Line 878:  		Case "NL"
Line 879:  			Return("Newfoundland")
Line 880:  		Case "NS"
Line 881:  			Return("Nova Scotia")
Line 882:  		Case "NT"
Line 883:  			Return("Northwest Territories")
Line 884:  		Case "NU"
Line 885:  			Return("Nunavut")
Line 886:  		Case "ON"
Line 887:  			Return("Ontario")
Line 888:  		Case "PE"
Line 889:  			Return("Prince Edward Island")
Line 890:  		Case "QC"
Line 891:  			Return("Quebec")
Line 892:  		Case "SK"
Line 893:  			Return("Saskatchewan")
Line 894:  		Case "YT"
Line 895:  			Return("Yukon")
Line 896:  		Case Else
Line 897:  			Return("")
Line 898:  	End Select
Line 899:  End Function
Line 900:  
Line 901:  Function SitesStateArray() As String(,)
Line 902:  	Dim statesArray(,) As String = {{"7", "AL", "Alabama"}, {"36", "AK", "Alaska"}, {"84", "AZ", "Arizona"}, {"37", "AR", "Arkansas"}, _
Line 903:  		{"2", "CA", "California"}, {"45", "CO", "Colorado"}, {"8", "CT", "Connecticut"}, {"3", "DE", "Delaware"}, {"4", "FL", "Florida"}, _
Line 904:  		{"92", "GA", "Georgia"}, {"38", "HI", "Hawaii"}, {"43", "ID", "Idaho"}, {"51", "IL", "Illinois"}, {"58", "IN", "Indiana"}, _
Line 905:  		{"57", "IA", "Iowa"}, {"55", "KS", "Kansas"}, {"76", "KY", "Kentucky"}, {"56", "LA", "Louisiana"}, {"44", "ME", "Maine"}, _
Line 906:  		{"46", "MD", "Maryland"}, {"10", "MA", "Massachusetts"}, {"52", "MI", "Michigan"}, {"26", "MN", "Minnesota"}, {"42", "MS", "Mississippi"}, _
Line 907:  		{"77", "MO", "Missouri"}, {"41", "MT", "Montana"}, {"35", "NE", "Nebraska"}, {"5", "NV", "Nevada"}, {"39", "NH", "New Hampshire"}, _
Line 908:  		{"13", "NJ", "New Jersey"}, {"34", "NM", "New Mexico"}, {"20", "NY", "New York"}, {"15", "NC", "North Carolina"}, _
Line 909:  		{"40", "ND", "North Dakota"}, {"54", "OH", "Ohio"}, {"49", "OK", "Oklahoma"}, {"16", "OR", "Oregon"}, {"50", "PA", "Pennsylvania"}, _
Line 910:  		{"53", "RI", "Rhode Island"}, {"18", "SC", "South Carolina"}, {"33", "SD", "South Dakota"}, {"28", "TN", "Tennessee"}, _
Line 911:  		{"27", "TX", "Texas"}, {"47", "UT", "Utah"}, {"30", "VT", "Vermont"}, {"6", "VA", "Virginia"}, {"48", "WA", "Washington"}, _
Line 912:  		{"31", "WV", "West Virginia"}, {"24", "WI", "Wisconsin"}, {"32", "WY", "Wyoming"}}
Line 913:  
Line 914:  	Return statesArray
Line 915:  End Function
Line 916:  
Line 917:          #End ExternalSource
Line 918:          
Line 919:          
Line 920:          <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
Line 921:          Public Sub New()
Line 922:              MyBase.New
Line 923:              Dim dependencies() As String
Line 924:              CType(Me,Global.System.Web.UI.Page).AppRelativeVirtualPath = "~/include/functions.aspx"
Line 925:              If (Global.ASP.include_functions_aspx.__initialized = false) Then
Line 926:                  dependencies = New String(0) {}
Line 927:                  dependencies(0) = "~/include/functions.aspx"
Line 928:                  Global.ASP.include_functions_aspx.__fileDependencies = Me.GetWrappedFileDependencies(dependencies)
Line 929:                  Global.ASP.include_functions_aspx.__initialized = true
Line 930:              End If
Line 931:              Me.Server.ScriptTimeout = 30000000
Line 932:          End Sub
Line 933:          
Line 934:          Protected ReadOnly Property Profile() As System.Web.Profile.DefaultProfile
Line 935:              Get
Line 936:                  Return CType(Me.Context.Profile,System.Web.Profile.DefaultProfile)
Line 937:              End Get
Line 938:          End Property
Line 939:          
Line 940:          Protected ReadOnly Property ApplicationInstance() As ASP.global_asax
Line 941:              Get
Line 942:                  Return CType(Me.Context.ApplicationInstance,ASP.global_asax)
Line 943:              End Get
Line 944:          End Property
Line 945:          
Line 946:          <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
Line 947:          Private Sub __BuildControlTree(ByVal __ctrl As include_functions_aspx)
Line 948:              
Line 949:              #ExternalSource("D:\home\site\wwwroot\include\functions.aspx",1)
Line 950:              Me.InitializeCulture
Line 951:              
Line 952:              #End ExternalSource
Line 953:          End Sub
Line 954:          
Line 955:          <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
Line 956:          Protected Overrides Sub FrameworkInitialize()
Line 957:              MyBase.FrameworkInitialize
Line 958:              Me.__BuildControlTree(Me)
Line 959:              Me.AddWrappedFileDependencies(Global.ASP.include_functions_aspx.__fileDependencies)
Line 960:              Me.Request.ValidateInput
Line 961:          End Sub
Line 962:          
Line 963:          <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
Line 964:          Public Overrides Function GetTypeHashCode() As Integer
Line 965:              Return 5381
Line 966:          End Function
Line 967:          
Line 968:          <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
Line 969:          Public Overrides Sub ProcessRequest(ByVal context As System.Web.HttpContext)
Line 970:              MyBase.ProcessRequest(context)
Line 971:          End Sub
Line 972:      End Class
Line 973:  End Namespace
Line 974: 

 

Version Information: Microsoft .NET Framework Version:2.0.50727.8964; ASP.NET Version:2.0.50727.8962 / jester