登录失败:未知的用户名或密码错误?但我使用了正确的用户名和密码 [英] Logon failure: unknown user name or bad password? But I am using the right username and password
问题描述
我要xml文件中连接远程服务器。我写了我这样的代码:
I want to connect xml file in remote server. I wrote my code like this:
string XMLPATH = @"\\10.222.54.141\c$\Data\CL\Casinolink30\BuildFiles\Logging\980\NoLog4NetFile.UnitTest.Tests.nunit-results.xml";
FileWebRequest request = (FileWebRequest)FileWebRequest.Create(XMLPATH);
request.Credentials = new NetworkCredential("administrator", "Igtcorp123");
FileWebResponse response = request.GetResponse() as FileWebResponse;
Stream stReader = response.GetResponseStream();
XmlTextReader reader = new XmlTextReader(stReader);
int count = 100;
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Element)
{
if (reader.Name == "test-case")
{
//Console.WriteLine("testcase name:" + reader.GetAttribute("name"));
Console.WriteLine("testcase info");
Console.WriteLine("name: " + reader.GetAttribute("name").ToString());
//Console.WriteLine("success: " + reader.GetAttribute("success").ToString());
Console.WriteLine("------------------------------------");
}
}
}
我得到了一个错误:< STRONG>登录失败:未知的用户名或错误。
,我尝试这样做:
I got a error: "logon failure: unknown user name or bad". and I try to do this:
- 输入地址(10.222.54.141\c $ \Data\CL \Casinolink30\BuildFiles\Logging\980\NoLog4NetFile.UnitTest.Tests.nunit-results.xml)地址栏,并打开。一个对话框显示出来,让我添加用户名和密码。我输入正确的话,我成功地访问文件。
- 我运行上面的代码。我顺利拿到了数据。
- 我尝试这个程序中的其它计算机。他们可以访问该地址,但该程序无法正常工作。
我感到困惑呢?为什么会出现这种情况。
I am confused about this? Why does this happen?
现在我部署了我的项目到服务器上,我能顺利拿到我的本地主机地址数据(HTTP://本地主机:61547 /)服务器。 http://10.222.54.140:8080/ :但我无法通过远程地址获取在我的电脑数据。发生什么事?任何一个能帮助我吗? 。非常感激
Now I deployed my project to the server, I can successfully get my data in localhost address(http://localhost:61547/) on server. But I can not get data in my computer remotely through addr: http://10.222.54.140:8080/. What happen? Can any one help me? Much appreciate.
推荐答案
试着改变app.config文件了一下:
Try changing the app.config file a bit:
<system.net>
<defaultProxy useDefaultCredentials="false">
<proxy usesystemdefault="true"/>
</defaultProxy>
</system.net>
这可能会解决这个问题。
This might solve the problem.
?您可以在Web.config文件,如下补充一点:; XML版本=1.0>
You can add this as below in the Web.config file:
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<connectionStrings>
<add name="ApplicationServices"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.net>
<defaultProxy useDefaultCredentials="false">
<proxy usesystemdefault="True"/>
</defaultProxy>
</system.net>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" timeout="2880" />
</authentication>
这篇关于登录失败:未知的用户名或密码错误?但我使用了正确的用户名和密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!