Kiran Beladiya
New member
- Joined
- Dec 22, 2006
- Messages
- 4
- Programming Experience
- 1-3
I am facing problem while making web request by WebClient.
I am making request to google map geocode apge to findout the longitude and latitude of particular address.
Here is my code to do that :
Dim QueryString As String
Dim responseText As String = ""
Dim WC As New Net.WebClient
Dim SR As IO.StreamReader
QueryString = "?q=" & getValidAddressString() & "&output=csv&key=" & ConfigurationManager.AppSettings("GeoCodeKey")
Dim redirectURL As String = ConfigurationManager.AppSettings("GeoCodeURL") & QueryString
SR = New IO.StreamReader(WC.OpenRead(redirectURL))
responseText = SR.ReadToEnd()
SR.Close()
processResponseText(responseText)
The strange thing is that for same address string, the code is working without any problem in one page. While the same code(have copy pasted) in another page is throwing the following error :
Illegal characters in path.
Exception Details: System.ArgumentException
at System.Security.Permissions.FileIOPermission.HasIllegalCharacters(String[] str)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath)
at System.IO.Path.GetFullPath(String path)
at System.Net.WebClient.GetUri(String path)
at System.Net.WebClient.DownloadData(String address)
at KG.GeoCodeHelper.Page_Load(Object sender, EventArgs e) in
I am making request to google map geocode apge to findout the longitude and latitude of particular address.
Here is my code to do that :
Dim QueryString As String
Dim responseText As String = ""
Dim WC As New Net.WebClient
Dim SR As IO.StreamReader
QueryString = "?q=" & getValidAddressString() & "&output=csv&key=" & ConfigurationManager.AppSettings("GeoCodeKey")
Dim redirectURL As String = ConfigurationManager.AppSettings("GeoCodeURL") & QueryString
SR = New IO.StreamReader(WC.OpenRead(redirectURL))
responseText = SR.ReadToEnd()
SR.Close()
processResponseText(responseText)
The strange thing is that for same address string, the code is working without any problem in one page. While the same code(have copy pasted) in another page is throwing the following error :
Illegal characters in path.
Exception Details: System.ArgumentException
at System.Security.Permissions.FileIOPermission.HasIllegalCharacters(String[] str)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath)
at System.IO.Path.GetFullPath(String path)
at System.Net.WebClient.GetUri(String path)
at System.Net.WebClient.DownloadData(String address)
at KG.GeoCodeHelper.Page_Load(Object sender, EventArgs e) in