ورود

View Full Version : سوال: ERROR_SESSION_CREDENTIAL_CONFLICT در هنگام استفاده از wnetAddconnection



SReza1
چهارشنبه 16 فروردین 1391, 17:24 عصر
سلام. يك مشكلي برخورد كردم كه خيلي كلافه‌ام كرده. ثواب دنيا و آخرت داره كسي بتونه كمك كنه.
من براي نوشتن روي يك فولدر (فايل كپي كردن) كه البته فقط با يك كاربر خاص متونم وارد اون بشم از wnetAddconnection استفاده ميكنم. نمونه كدم هم اينه




NetR.dwScope := 2;
NetR.dwType := 1;
NetR.dwDisplayType := 3;
NetR.dwUsage := 1;
NetR.lpLocalName := nil;
NetR.lpRemoteName := pchar(remoteName);
NetR.lpProvider := nil;

Ret := WNetAddConnection2(NetR, pchar(myPass), pchar(myUser) , CONNECT_UPDATE_PROFILE and CONNECT_INTERACTIVE);




كد هيچ مشكلي نداره. مشكل اونجا پيدا ميشه كه من مثلا از ip اون سيستم در فولدر در اون هست در addressbar ويندوز استفاده كنم و اون وقت پيچاره ميشم و ERROR_SESSION_CREDENTIAL_CONFLICT رو ميده. بايد سيستم logoff بشه تا مشكل حل شه.(به بيان ديگر با Session از بين بره) اينكه خيلي مسخره است كه نشه به فولدر دوباره متصل شم.از دوستان و علما كسي ميتونه كمك كنه؟ جالبتر اينه براي اتصال به SQL server در Connection از Ip هم استفاده كني همين جور گير ميده!! نمبتونم كه connection رو از بين ببرم!!

Felony
سه شنبه 22 فروردین 1391, 21:52 عصر
به نقل از MSDN :


In Windows NT, on the other hand, you can use the API with multiple sets of user credentials. However, one major limitation applies, namely, that connections to a given server or its shared resources have to be made within the context of a single set of credentials. For an initial connection, if you use NULL for lpPassword or lpUsername, the interactive user's credentials are used by default. If there has been a successful initial connection to the server, subsequent attempts to open a connection using a different set of credentials results in error 1219 (ERROR_SESSION_CREDENTIAL_CONFLICT), which indicates a conflict between the supplied set of credentials and the existing one. To establish a connection using a different set of credentials, first you have to cancel the existing connections to the server using WNetCancelConnection2().

همه چیز واضحه ...

SReza1
یک شنبه 27 فروردین 1391, 18:07 عصر
به نقل از MSDN :



همه چیز واضحه ...

دوست عزيز . در سوالم گفتم كه نميتونم connectionهاي ديگر را از بين ببرم.(مثله SQL server Connection ) خود ويندوز چطوري اين كار رو ميكنه؟