[英]Application Updater - Keep getting 401 Unauthorized error
Im testing out the .Net application updater component as decribed here Updater component 我按照此处描述的方法测试了.Net应用程序更新程序组件
Im getting an issue that when the client tries to access the update.xml file I am getting a 401 Unathorized access error. 我遇到一个问题,当客户端尝试访问update.xml文件时,出现了401 Unathorized访问错误。
I can see the update.xml file when I go to the url through the web browser. 通过Web浏览器访问url时,我可以看到update.xml文件。 Any ideas what Im doing wrong?
有什么想法我做错了吗?
The "server" part is just on local host. “服务器”部分仅在本地主机上。
Edit 编辑
//Retrieve the File
HttpWebRequest Request = (HttpWebRequest)HttpWebRequest.Create(url);
Request.Headers.Add("Translate: f");
Request.Credentials = CredentialCache.DefaultCredentials;
//Set up the last modfied time header
if (File.Exists(filePath))
Request.IfModifiedSince = LastModFromDisk(filePath);
try
{
Response = (HttpWebResponse)Request.GetResponse();// this is where error is being thrown.
}
Kind Regards 亲切的问候
Ash 灰
Have you tried running your uri through fiddler? 您是否尝试过通过提琴手操作您的uri? - http://www.fiddler2.com/fiddler2/
-http://www.fiddler2.com/fiddler2/
Using this tool you can see the request and response, and potentially work out what is causing the issue more than just a 401 error. 使用此工具,您可以查看请求和响应,并可能找出导致问题的原因,而不仅仅是401错误。
Is your computer connecting to the Internet via an authenticating web proxy? 您的计算机是否通过身份验证的Web代理连接到Internet? If it is, .NET won't talk to the proxy unless the application configuration file contains a bit like this:
如果是这样,.NET将不会与代理通信,除非应用程序配置文件包含如下内容:
<system.net>
<defaultProxy useDefaultCredentials="true"/>
</system.net>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.