c# to vb.net conversion problem

tcl4p

Well-known member
Joined
Feb 29, 2008
Messages
48
Programming Experience
1-3
I have a vb.net forms program that I would like to use a c# function I use in another program. I used one of the c# to vb.net converters, but still have a problem.
The C# code is:
string[] computer_name = System.Net.Dns.GetHostEntry(Request.ServerVariables["remote_addr"]).HostName.Split(new Char[] { '.' });
The VB.net code convertison is:
Dim computer_name As String() = System.Net.Dns.GetHostEntry(Request.ServerVariables("remote_addr")).HostName.Split(New [Char]() {"."C})

The problem is is get an error in the "Request.ServerVariables" that states "Request is not declared. It may be inaccessible due to it protection level".
I made sure I was using the same Using/Imports, but that hasn't cleared up the problem.

Would appreciate any help in resolving this problem.
 
In your C# project, what is `Request`? It looks like it might be the Request property of the current Page in a Web Forms project. If that's so then your VB code would have to be in a Page too. Is it?
 
Back
Top