Last post Mar 27, 2015 05:17 AM by Krunal Parekh
Mar 26, 2015 05:13 PM|janilane|LINK
In my first web request, I'm posting to a URL login site, then when the login is successful I need to use that same request object (maybe because it has the security key already when login was successful) to post data.
I tried changing the proxy of the request object, but it won't let me, exception is thrown because it says I can no longer change it since it has been submitted already.
Dim myNewURLValue As String = "https://contoso.com"
Dim newUri As Uri = New Uri(myNewURLValue)
If (request IsNot Nothing) Then
request.KeepAlive = True
myProxy = DirectCast(request.Proxy, WebProxy)
myProxy.Address = newUri
request.Proxy = myProxy
EXCEPTION: This operation cannot be performed after the request has been submitted.
Thank you very much.
Mar 27, 2015 05:17 AM|Krunal Parekh|LINK
The "This operation cannot be performed after the request has been submitted."
exception occurs because when you ask for response from the server it means your request has already been submitted and you can not use that request again. if you want to post data again than you need to create new web request. you should research
that after login in to URL site is it returning any token or id that can be used to identify the use. it all depends on how the functionality on the URL site has been implemented. There must be some mechanism
on url site to identity the request are coming from which user. I suggest you should research on that.
Hope this helps.