Why code:
client->Credentials = gcnew NetworkCredential("username", "password"); doesnt work for me?
Error 1 error C2061: syntax error : identifier 'NetworkCredential' Good catch by and thanks for confirming, . The C2061 here means the compiler never resolved the .NET type you were trying to use. That normally comes from one of three issues: the file is being built as native C++ (not C++/CLI), the assembly that contains the type is not referenced, or the type’s namespace hasn’t been made visible to the compiler.
Checklist to avoid C2061 in this situation:
/clr under Project Properties -> Configuration Properties -> General. #using <System.dll>). If the error persists, verify you are editing a managed source file (no accidental plain-C++ compile settings), check for typos/case sensitivity, and try a minimal test file to isolate the problem. For details on the type and the compiler option, see the official docs: NetworkCredential class documentation and .
Jump to Post— jonsca 1,059Do you have
using namespace System::Net;at the top?
Do you have using namespace System::Net; at the top?
Ehh..thought that System::Net:Mail
Will be enough :) Thx once again..
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.