Below is my code and I get the above mentioned error in I am trying to pass blank in integer .

Private ReadOnly Property GPLegalEntityId() As Integer
If Request.QueryString("GPLegalEntityId") = "" Then
Return ""
Return Convert.ToInt32(Request.QueryString("GPLegalEntityId"))
End If

End Get
End Property

You cannot convert an empty string to an integer, that's why you are receiving the error. A querystring is treated as a string. If the length of the querystring is above 0 numbers, and contains no letters, this code will work. You will receive the same error, however, if your querystring is 1231k213, all due to the K. You have to remove the letters and characters from your string, and then convert it. To do this, use something like the function below to make it an integer. Also, make sure that the numbers do not exceed the integer length, otherwise you will need to convert it into a LONG instead of INTEGER.

You may also use string instead of integer to quickily put a fix to your problem, but you will have this problem again if there are more than integers in your querystring.

'Make Querystrings Ints
Public Function MakeInt(ByVal stringint As String) As String
Dim lngCount As Long
Dim strOut As String
if Len(stringint) > 0 then
  for lngCount = 1 to len(stringint)
    if isnumeric(mid$(stringint, lngCount, 1)) then
      strOut = strOut & mid$(stringint, lngCount, 1)
    end if
  next lngCount
end if
MakeInt = strOut
end function

Also, always trim you querystring to remove those spaces "(Trim(Request.QueryString(""))"