473,387 Members | 1,603 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,387 software developers and data experts.

Erros -> User credentials cannot be used for local connections

I am writing a web portal to modify the users account password.

However, it is confusing me... for a few days for this error.

It has been work fine while debugging on the development web server, however when i run on the on the IIS (on same computer), it has this error: A specified logon session does not exist. It may already have been terminated. But if I connect the local computer by supplying the admin username and password, it has this error: "User credentials cannot be used for local connections", is it there no method to connect to local computer if the admin is not logged on? Thanks

The code to connect the directory service:
if (ServerName != ".")
{
// Remote
ConnectionOptions c = new ConnectionOptions();
c.Username = AdminUsername;
c.Password = AdminPassword;
c.Impersonation = ImpersonationLevel.Impersonate;
ms = new ManagementScope("\\\\" + ServerName + "\\root\\cimv2", c);
}
else
{
// Local
ms = new ManagementScope("\\\\" + ServerName + "\\root\\cimv2");
}
try
{
ms.Connect();
......
} catch {
.......
}
Jul 24 '07 #1
1 7510
I found that ... the problem is the Windows 2003 Server SP2..... thanks all guy
"LamSoft" <[nospam]la*****@lamsoft.netwrote in message news:uU*************@TK2MSFTNGP02.phx.gbl...
I am writing a web portal to modify the users account password.

However, it is confusing me... for a few days for this error.

It has been work fine while debugging on the development web server, however when i run on the on the IIS (on same computer), it has this error: A specified logon session does not exist. It may already have been terminated. But if I connect the local computer by supplying the admin username and password, it has this error: "User credentials cannot be used for local connections", is it there no method to connect to local computer if the admin is not logged on? Thanks

The code to connect the directory service:
if (ServerName != ".")
{
// Remote
ConnectionOptions c = new ConnectionOptions();
c.Username = AdminUsername;
c.Password = AdminPassword;
c.Impersonation = ImpersonationLevel.Impersonate;
ms = new ManagementScope("\\\\" + ServerName + "\\root\\cimv2", c);
}
else
{
// Local
ms = new ManagementScope("\\\\" + ServerName + "\\root\\cimv2");
}
try
{
ms.Connect();
......
} catch {
.......
}
Jul 24 '07 #2

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

Similar topics

0
by: LY | last post by:
Hi I'm in the process of upgrading all our solutions and projects from ..NET 2002 to .NET 2003. Well, of course it did not go smoothly. I am running into a problem that I can't figure out. ...
6
by: perspolis | last post by:
Hi I have a question about using exceptions or showing error messages .I say this by an example first way: if(n<0 and w<0) MessageBox.Show("please enter positive") else if (n=0 or w>0)...
2
by: Cleber Marinho | last post by:
Please, could someone explain me why there are errors in the following code? #include <iostream> #include <string> using namespace std; class Log { public: explicit Log(const string& msg)...
1
by: Paul Turley | last post by:
Since upgrading to .Net 1.1 & VS 2003, I'm getting the following error when I try to render a Crystal Report in a web form: Parser Error Message: The base class includes the field...
2
by: Geoff O | last post by:
I have a try catch block in a web service that executes ADO.NET code that interfaces with an Oracle database. In addition, I have a try catch block in the client around the call to the web...
2
by: Pedro Mir | last post by:
Hello, I get no build errors when I select build option. However, I get errors when try to deploy the website, Why this occurs? Thanks, Pedro
1
by: Rick | last post by:
I want to have my application create a memory/stack dump for some non-fatal exceptions of my choosing. Basically I want to see the state of the variables when the exception occurred. Is this...
5
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hello, I'm using a control (black box control) in my form (an ActiveX/Com control). and I need to take the control as an image. The controls is showing some kind of graph, and I want to create a...
6
by: grbgooglefan | last post by:
I am compiling CPP program which uses CPython API functions from Python 2.5.1 source code First I compiled with this commanline, that time I got "pyconfig.h" not found. g++ -Os -I../../Include...
0
by: Robson Felix | last post by:
Folks, I've been trying to put some legacy databases I have here through SqlMetal. Most of it goes well, but in some stored procedures, I get errors for temp tables that don't exist and so on. I...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.