如何从需要身份验证的日志文件中读取数据? [英] How to read data from a log file which needs authentication?
本文介绍了如何从需要身份验证的日志文件中读取数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我需要开发一个解析日志文件数据的工具。日志文件放在Web服务器上,它需要身份验证才能访问该文件,我确实有我的凭据但不知道如何实现将使用凭据访问日志文件的代码。
有没有人知道如何通过提供访问日志文件的凭据来实现读取日志文件的C#代码。
任何帮助都将不胜感激。
提前致谢,
kane
Hi All,
I need to develope a tool which will parse the log file data. The log file is placed at web server and it needs authentication to access the file, I do have the credentials with me but don''t know how to implement the code that will use the credentials to access the log file.
Does anybody knows how to implement a C# code that reads the log file by providing the credentials to access the log file.
Any kind help would be appreciated.
Thanks in advance,
kane
推荐答案
在Codeproject上试试这篇文章:一个小的用于冒充用户的C#类 [ ^ ]
然后你可以作为另一个用户执行代码:
Try this article here at Codeproject: A small C# Class for impersonating a User[^]
Then you can execute code as another user:
using ( new Impersonator( "myUsername", "myDomainname", "myPassword" ) )
{
var content = System.IO.File.ReadAllText("");
}
这篇关于如何从需要身份验证的日志文件中读取数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文