Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C# - ASP.Net

Status
Not open for further replies.

AtomicChip

Programmer
May 15, 2001
622
CA
I'm having problems converting the following VB.Net code to C#:

sub Page_Load ()

dim au
dim str

set au = server.createobject("Persits.AspUser")

str = au.getusername

end sub

Using vb.net, the code works great. I tried the following using C#:

public int Page_Load()
{
string userName;
object au = server.createobject("Persits.AspUser");

userName = au.GetUserName();
}

When I use the C# version of this, I get the following error:

Compiler Error Message: CS0117: 'object' does not contain a definition for 'GetUserName'

Any suggestions? -----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
 
The class object doesn't contain any function named GetUserName().
But I bet that there is a class that should be used for this thing and contains that function.
With other words, you need to create an object of the right class and then assign an object to it.
I don't know which class that is, so you have to search for that.

Larsson
 
Larsson - If you're setting the object variable to the class, then the function from the class "Persits.AspUser" should automatically be carried over to the variable, should it not? -----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
 
Maybe, but it clearly doesn't work in this case...
I shall se what I can find.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top