473,394 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

WebRequest.Create

Thank you in advance for any and all assistance.

I'm trying to create a call to a web page to validate and register software.
The code I'm using is:

Private Sub OK_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles OK.Click
Dim WebRequest As HttpWebRequest
Dim instance As HttpWebRequest =
WebRequest.Create("https://www.plimus.com/jsp/validateKey.jsp?action=REGISTER&productId=####&key =LicenseTextBox.text&uniqueMachineId=GetOSProductK ey")
End Sub

The error I'm getting is that .Error
1 'Create' is not a member of
'EZTechTools.LoginForm1.HttpWebRequest'. E:\EZTechToolsProMo\EZTechTools\LoginForm1.vb 119 42 EZTechToolsPro
HELP Please!
--
Michael Bragg, President
eSolTec, Inc.
a 501(C)(3) organization
MS Authorized MAR
looking for used laptops for developmentally disabled.
Sep 6 '06 #1
3 9549
I'm trying to create a call to a web page to validate and register software.
The code I'm using is:

Private Sub OK_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles OK.Click
Dim WebRequest As HttpWebRequest
Dim instance As HttpWebRequest =
WebRequest.Create("https://www.plimus.com/jsp/validateKey.jsp?action=REGISTER&productId=####&key =LicenseTextBox.text&uniqueMachineId=GetOSProductK ey")
End Sub

The error I'm getting is that .Error
1 'Create' is not a member of
'EZTechTools.LoginForm1.HttpWebRequest'. E:\EZTechToolsProMo\EZTechTools\LoginForm1.vb 119 42 EZTechToolsPro
HELP Please!
This looks like a name collision. There is in .net a shared method, namely
System.Net.WebRequest.Create
And you have a variable, WebRequest of type HttpWebRequest.
So, when you code WebRequest.Create, it sounds like you want the first and
not the second. If that is true, then change WebRequest.Create to
System.Net.WebRequest.Create. In any event, I suggest you change your
declaration
Dim WebRequest As HttpWebRequest
to a different name (ie change WebRequest to something else). It is poor
form to use a class name for a variable name. It is like coding
Dim String as Integer.

Sep 6 '06 #2
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles OK.Click
If Username.Text Is Nothing And License.Text Is Nothing Then
MessageBox.Show("Please enter your registered name.")
Username.Focus()
ElseIf Username.Text <"" And License.Text Is Nothing Then
MessageBox.Show("Please enter your registration number:
###-####-####-####")
License.Focus()
Else
Dim myWebRequest As Net.WebRequest
Dim instance As Net.WebRequest =
Net.WebRequest.Create("https://www.plimus.com/jsp/validateKey.jsp?action=REGISTER&productId=#####&ke y="
+ "License.text" + "&uniqueMachineId=" + GetOSProductKey())
Dim response As Net.HttpWebResponse = request.GetResponse()
Dim reader As StreamReader = New
StreamReader(response.GetResponseStream())
Dim str As String = reader.ReadLine()
Do While str.Length 0
str = str + reader.ReadLine()
Loop

End If
End Sub

now the error that I'm getting is:
Error 4 Name 'request' is not
declared. E:\EZTechToolsProMo\EZTechTools\frmRegistration.vb 122 51 EZTechToolsPro

Please someone help me fix this. I've been trying to get this resolved for
nearly three days now.
--
Michael Bragg, President
eSolTec, Inc.
a 501(C)(3) organization
MS Authorized MAR
looking for used laptops for developmentally disabled.
"AMercer" wrote:
I'm trying to create a call to a web page to validate and register software.
The code I'm using is:

Private Sub OK_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles OK.Click
Dim WebRequest As HttpWebRequest
Dim instance As HttpWebRequest =
WebRequest.Create("https://www.plimus.com/jsp/validateKey.jsp?action=REGISTER&productId=####&key =LicenseTextBox.text&uniqueMachineId=GetOSProductK ey")
End Sub

The error I'm getting is that .Error
1 'Create' is not a member of
'EZTechTools.LoginForm1.HttpWebRequest'. E:\EZTechToolsProMo\EZTechTools\LoginForm1.vb 119 42 EZTechToolsPro
HELP Please!

This looks like a name collision. There is in .net a shared method, namely
System.Net.WebRequest.Create
And you have a variable, WebRequest of type HttpWebRequest.
So, when you code WebRequest.Create, it sounds like you want the first and
not the second. If that is true, then change WebRequest.Create to
System.Net.WebRequest.Create. In any event, I suggest you change your
declaration
Dim WebRequest As HttpWebRequest
to a different name (ie change WebRequest to something else). It is poor
form to use a class name for a variable name. It is like coding
Dim String as Integer.
Sep 7 '06 #3
Hello Michael,

I think your code logic is absolute right. The error you encounter is
caused by some tiny syntax mistakes. e.g ,

The following statement in your code

Dim response As Net.HttpWebResponse = request.GetResponse()

should be changed to

Dim response As Net.HttpWebResponse = instance.GetResponse()

since you never declared a variable named "request".

Here is a complete code sinppet on using the webrequest to query a remote
http document:

===============================

Protected Sub btnRequest_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnRequest.Click

Dim request As Net.HttpWebRequest
Dim response As Net.HttpWebResponse

Dim url As String = "http://www.microsoft.com"

request = Net.WebRequest.Create(url)
request.Method = "Get"

'optional security setting
request.Credentials = Net.CredentialCache.DefaultCredentials

'optional proxy setting
request.Proxy = New Net.WebProxy("jpnproxy", 80)

response = request.GetResponse()

Dim sr As IO.StreamReader = New
IO.StreamReader(response.GetResponseStream())

Dim responseContent As String = sr.ReadToEnd()

sr.Close()
response.Close()

'content is in responseContent variable

End Sub
===================================

Here are some other web article describing using webrequest component to
access remote http document:

#Downloading Web Pages in VB.NET
http://www.vbdotnetheaven.com/Code/M...esVBNETMCB.asp

http://www.vbforums.com/archive/index.php/t-260654.html
Hope this helps some.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 7 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Paul | last post by:
Hello, First I want to refer to the problem "WebRequest : execute a button" of a few days ago. The way I solved it, I loose my session, and as a consequence my session variables. I don't want...
8
by: John K. | last post by:
Hi I was wondering if it's possible to use the WebRequest class to access a file on windows shared folder with authentication? If yes, what would the syntax be? I've tried to look this up in the...
4
by: Terry | last post by:
Hello, I am trying to get a response for an .aspx page in my current project (same virtual directory) by using WebRequest.GetResponse but I keep getting a exception with "500 Internal server...
12
by: ThyRock | last post by:
I am working on a WebRequest accessing the US Postal Service WebTools test API. This service uses a DLL file (ShippingAPITest.dll) with a query string which includes XML. The web service accepts...
0
by: jesper.hvid | last post by:
Hi. I've noticed, after moving some of our code to 2.0, that System.Net.WebRequest.Create(System.String) and System.Uri(System.String) no longer behave as they did in 1.1 framework. Example:...
1
by: David Satz | last post by:
Hello--I just upgraded to Visual Studio .NET 2005 and suddenly, all my .NET 1.1 applications that accessed Web sites have broken. For example, this code: WebClient wc = new WebClient();...
4
by: Sathyaish | last post by:
The WebRequest class implements IWebRequestCreate and hence, a method Create. This method has two other overloads, one of which is a private method. Here's how it looks: public static...
2
by: Zytan | last post by:
I know that WebRequest.GetResponse can throw WebException from internet tutorials. However in the MSDN docs: http://msdn2.microsoft.com/en-us/library/system.net.webrequest.getresponse.aspx It...
3
by: Dave | last post by:
string m_request = some_web_page; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(m_request ); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Which works...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.