调用 URL - c# [英] Invoking a URL - c#

查看:30
本文介绍了调用 URL - c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在 C# 中调用一个 URL,我只是对调用感兴趣,而不关心响应.当我有以下内容时,是否意味着我正在调用 URL?

I m trying to invoke a URL in C#, I am just interested in invoking, and dont care about response. When i have the following, does it mean that I m invoking the URL?

 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

推荐答案

您需要实际执行请求:

var request = (HttpWebRequest)WebRequest.Create(url);
request.GetResponse();

对 GetResponse 的调用向服务器发出出站调用.如果你不关心它,你可以放弃响应.

The call to GetResponse makes the outbound call to the server. You can discard the response if you don't care about it.

这篇关于调用 URL - c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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