从服务器读取文件并在启动时弹出 [英] reading file from server and giving popup at start up

查看:72
本文介绍了从服务器读取文件并在启动时弹出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我想开发一个应用程序,它可以从服务器读取文件并提供弹出窗口,就像许多防病毒程序在系统启动时在右上角提供的一样.
我需要知道:
我应该为此学习什么?
仅文件IO足以执行此操作吗?

该文件可以是txt格式,需要读取.

谢谢

Hello,

I want to develop an application which reads a file from the server and gives popup window like many antivirus programs give in the right corner at system startup.
I need to know:
What should I study for that?
Is only file IO enough to do this?

The file can be in txt formate which need to be read.

Thanks

推荐答案

你好;
要读取文件,您可以使用普通的system.IO函数通过C#Windows应用程序进行文件流传输,但是这取决于服务器在哪里连接到服务器以及如何通过HTTP访问文件?或从数据库中读取远程SQL?
只是解释更多您在想什么,您的确切目标是什么,我们将帮助您进行编码...
问候...

如何通过代理服务器使用HTTP下载文件.本文介绍了使用HTTP下载文件时如何传递代理服务器网络凭据.
传递网络凭据
如果您的公司正在使用代理服务器连接到Internet,则必须传递代理设置才能使用HTTP从Internet下载文件.为此,您需要创建一个WebProxy实例,并设置其Credentials属性,该属性为NetworkCredential并采用userId,密码和网络域. 以下是使用网络凭据的代码:
hello;
for reading a file you can use normal system.IO functions for file streaming using C# windows application, but it depends where is your server how you are connected to it and how you want to access your file , by HTTP ?? or remote SQL reading from database??
just explain more what are you thinking about and what are your exact aims and We will help you in coding ...
regards...

how to download files using HTTP by passing Proxy server. This article explains how to pass proxy server network credentials when downloading files using HTTP.
Passing Network Credentials
If your company is using proxy server to connect to the Internet, you will have to pass proxy settings to download files from the Internet using HTTP. To do so, you need to create a WebProxy instance, and set its Credentials property, which is NetworkCredential and takes userId, password, and network domain.
Here is the code that uses network credentials:
string result = "";
try
{
WebProxy proxy = new WebProxy("http://proxy:80/", true);
proxy.Credentials = new NetworkCredential("userId", "password", "Domain"); 
WebRequest request = WebRequest.Create(http://www.c-sharpcorner.com);
request.Proxy = proxy;
// Send the ''HttpWebRequest'' and wait for response. 
HttpWebResponse response = (HttpWebResponse)request.GetResponse(); System.IO.Stream stream = response.GetResponseStream();
System.Text.Encoding ec = System.Text.Encoding.GetEncoding("utf-8");
System.IO.StreamReader reader = new System.IO.StreamReader(stream, ec);
char [] chars = new Char[256];
int count = reader.Read(chars, 0, 256);
while(count > 0)
{
string str = new String(chars, 0, 256);
result = result + str;
count = reader.Read(chars, 0, 256);
}
response.Close();
stream.Close();
reader.Close();
}
catch(Exception exp)
{
string str = exp.Message;
}


将HTTPS与WebProxy类一起使用
为代理服务器创建WebProxy类实例以传递代理以使用HTTP从Internet下载文件时,代码如下所示:
WebProxy代理=新的WebProxy("http://proxy:80/",true);
但是,当您要从HTTPS下载文件时,此代码将不起作用.您需要使用以下代码为HTTPS创建WebProxy实例:


Using HTTPS with WebProxy Class
When you create a WebProxy class instance for a proxy server to pass proxy to download files from the Internet using HTTP, code looks like this:
WebProxy proxy = new WebProxy("http://proxy:80/", true);
However, this code will not work when you want to download a file from HTTPS. You need to use the following code to create a WebProxy instance for HTTPS:

WebProxy myProxy = new WebProxy("server.https.com", 443);



希望能帮助您..问候..



hope that helps you .. regards..


这篇关于从服务器读取文件并在启动时弹出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆