English 中文(简体)
利用C#访问网站
原标题:Accessing a website using C#

I m试图申请7台窗户电话。 这项评估将基本从我们作为工作时间表使用的网站上检索信息,然后将被检索的信息重新归入一个星体。 坦率地说,我们不知道什么地方开始。 如何重新计算胎儿。 是否应当使用网络用户类别? http://webrequest_? 或者说什么?

所有想法都经过了计算。

a:-“pic.

更新:

Okay要么完全 st,要么与“i m”书写法有过错,即可以 figure。 我使用的是你写的BUTi号相同的代码,这仍然有一种错误,即Proxy的定义不在系统中。 网上查询: 这是我的法典(工作版本):

    private void MainPage_Loaded(object sender, RoutedEventArgs e)
    {
        if (!App.ViewModel.IsDataLoaded)
        {
            App.ViewModel.LoadData();
        }
        string url = "https://medinet.se/*****/schema/ibsef";
        WebRequest request = WebRequest.Create(url);
        request.BeginGetResponse(new AsyncCallback(ReadWebRequestCallBack), request);
    }

    private void ReadWebRequestCallBack(IAsyncResult callbackResult)
    {
        try
        {
            WebRequest myRequest = (WebRequest)callbackResult.AsyncState;
            WebResponse myResponse = (WebResponse)myRequest.EndGetResponse(callbackResult);

            using (StreamReader httpwebStreamReader = new StreamReader(myResponse.GetResponseStream()))
            {
                string results = httpwebStreamReader.ReadToEnd();
                Dispatcher.BeginInvoke(() => parsertextBlock.Text = results);
            }
            myResponse.Close();
        }
        catch (Exception ex)
        {
            System.Diagnostics.Debug.WriteLine(ex.ToString());
            Dispatcher.BeginInvoke(() => parsertextBlock.Text = ex.ToString());
        }
    }

但如果是增加请求。 Pr! i 出现错误,在(System.Net.WebRequest)中没有Peoxy的定义。 坦率地说,一开始就这样做了。

阁下

页: 1

最佳回答

这一过程称为“筛选Scrape”,建议你使用Html Agility Pack 。 提供网络服务,从你的网站上检索信息,并重新安排适当格式。 利用电话和显示您的数据。

http://msdn.microsoft.com/en-us/library/system.net.com/en-us/library/system.com/rel=“nofollow”http://msdn.microsoft.com/en-us/library/system.net.http://webrequest.aspx>/repons/ds/href=http://msdn.microsoft.com/librasystem=web.net.aspresponse/index.htm。 。

TIP: Set the WebRequest. Proxy property (http://msdn.microsoft.com/en-us/library/system.net.webrequest.proxy.aspx ) to abolition, as i found it will bemore.

<><>UPDATE: 网上查询

<Proxy = 无在网上查询时表示反对避免最初的拖延(这样,请求就赢得了对近似的自动检测,即更快)。

WebRequest req = WebRequest.Create("yourURL");
req.Proxy = null;

它位于该系统。 网上名称空间这样使用<代码>使用系统。 净额:

System.Net.WebRequest req = WebRequest.Create("yourURL");
req.Proxy = null;

问题。

问题回答

暂无回答




相关问题
Howto get started with C# 4.0 and .NET 4.0?

I don t want to download Visual Studio 2010. How can I start studying (not developing real applications) C# 4.0 and .NET 4.0 with just a text editor? Can I just download C# 4.0 compiler and .NET 4.0 ...

Mocking Framework with C# 4.0 Support?

Anybody know of a mocking framework that supports C# 4.0? Doesn t matter which one ATM, just need something that will work.

Unit Testing interface contracts in C#

Using the Code Contracts tools available in VS2010 Beta 2, I have defined an interface, a contract class for that interface and two classes that implement the interface. Now when I come to test the ...

How to Iterate Through Array in C# Across Multiple Calls

We have an application where we need to de-serialize some data from one stream into multiple objects. The Data array represents a number of messages of variable length packed together. There are no ...

IronPython ScriptRuntime equivalent to CPython PYTHONPATH

The following import works inside ipy.exe prompt but fails using IronPython ScriptRuntime inside a C# 4.0 program. import ConfigParser C# code: using System; using System.Collections.Generic; using ...

i cant understand the following code

Matrix<float> trainData2 = trainData.GetRows(intVar >> 1, intVar, 1); intVar is integer type... please help me to understand this code.

热门标签