Hi

I am using below code in my webform, it work fine. How can I put this code in class.vb file and call in many asp.net pages?

Dim computer_name() As String
computer_name = split(System.Net.Dns.GetHostEntry(Request.ServerVariables("remote_addr")).HostName, ".")
Me.lblcompname.Text = computer_name(0).ToUpper

Pls help me

Maideen

You can create a static class with static members.

http://msdn.microsoft.com/en-us/library/vstudio/79b3xss3.aspx

Call the static method from your page. For example...

 lblcompname.Text = ClassName.GetName()

The code to get the computer name is in the static method. It returns the computer name.toUpper()

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.