string url = "";

string usernamePassword = username + ":" + password;
HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(url);
myReq.Credentials = new NetworkCredential(username, password);
//CredentialCache mycache = new CredentialCache();
//mycache.Add(new Uri(url), "Basic", new NetworkCredential());
// myReq.Credentials = mycache;
//myReq.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(new ASCIIEncoding().GetBytes(usernamePassword))); //HttpWebResponse b = (HttpWebResponse)myReq.GetResponse();
//Stream stream = b.GetResponseStream();
//StreamReader content = new StreamReader(stream); WebResponse wr = myReq.GetResponse();
Stream receiveStream = wr.GetResponseStream();
StreamReader reader = new StreamReader(receiveStream, Encoding.UTF8);
string content = reader.ReadToEnd();
textBox1.Text = content + "\r\n" + textBox1.Text;

访问需要HTTP Basic Authentication认证的资源的c#的实现 将账号密码放入url的更多相关文章

  1. 访问需要HTTP Basic Authentication认证的资源的各种开发语言的实现

    什么是HTTP Basic Authentication?直接看http://en.wikipedia.org/wiki/Basic_authentication_scheme吧. 在你访问一个需要H ...

  2. 访问需要HTTP Basic Authentication认证的资源的c#的实现

    string username="username"; string password="password"; //注意这里的格式哦,为 "usern ...

  3. HTTP Basic Authentication认证的各种语言 后台用的

    访问需要HTTP Basic Authentication认证的资源的各种语言的实现 无聊想调用下嘀咕的api的时候,发现需要HTTP Basic Authentication,就看了下. 什么是HT ...

  4. HTTP Basic Authentication认证

    http://smalltalllong.iteye.com/blog/912046 ******************************************** 什么是HTTP Basi ...

  5. HttpClient 三种 Http Basic Authentication 认证方式,你了解了吗?

    Http Basic 简介 HTTP 提供一个用于权限控制和认证的通用框架.最常用的 HTTP 认证方案是 HTTP Basic authentication.Http Basic 认证是一种用来允许 ...

  6. HTTP Basic Authentication认证(Web API)

    当下最流行的Web Api 接口认证方式 HTTP Basic Authentication: http://smalltalllong.iteye.com/blog/912046 什么是HTTP B ...

  7. webApi 验证basic-authentication认证的资源的各种语言的实现

    HTTP Basic authentication (BA) 是一个基于http请求的,简单验证.详细资料:https://en.wikipedia.org/wiki/Basic_access_aut ...

  8. Web services 安全 - HTTP Basic Authentication

    根据 RFC2617 的规定,HTTP 有两种标准的认证方式,即,BASIC 和 DIGEST.HTTP Basic Authentication 是指客户端必须使用用户名和密码在一个指定的域 (Re ...

  9. Edusoho之Basic Authentication

    通过如下代码,可以正常请求并获取对应的数据: curl -X POST -H "Accept:application/vnd.edusoho.v2+json" -H "A ...

随机推荐

  1. 笔记本无法连接校园网,windows诊断显示校园网之未响应

    打开cmd(管理员): 输入以下四条,每一条都按enter ipconfig /flushdns ipconfig /registerdns ipconfig /release ipconfig / ...

  2. IDEA社区版(Community)和付费版(UItimate)的区别

    比对类型 Ultimate(终极版,付费) Community(社区版,免费) 语言支持 Java Java Groovy Groovy Kotlin Kotlin Scala(通过插件) Scala ...

  3. 20200311_解决Could not resolve host: mirrorlist.centos.org

    [root@localhost ~]# yum -y install wget 已加载插件:fastestmirror Determining fastest mirrors Could not re ...

  4. 第八章 Python类中常用的特殊变量和方法

    上章花了近三十章节介绍类的知识,本章估计内容也比较多,讲完这些,其实还有更多.为什么这么多类有关的知识呢,这是因为在Python里面一切皆对象,就连整型.浮点数.字符串这些比较常规的类型都是作为类来实 ...

  5. 第2章 Python编程基础知识目录

    第2.1节 简单的Python数据类型.变量赋值及输入输出 第2.2节 Python的语句 第2.3节 Python运算符大全 老猿Python,跟老猿学Python! 博客地址:https://bl ...

  6. DeepFM——tensorflow代码改编

    本人代码库: https://github.com/beathahahaha/tensorflow-DeepFM-master-original DeepFM原作者代码库: https://githu ...

  7. 公司只提供签名服务,不提供证书文件,如何打包Electron应用

    需求 稍微正规点的公司,都要为自己开发的软件做代码签名,如下图所示 代码签名的主要目的是为了确保软件的来源(这个软件是由谁生产的)和软件的内容不被篡改 一个软件公司可能有很多团队,很多开发者,开发不同 ...

  8. AcWing 232. 守卫者的挑战

    题目链接 大型补档计划. 比较显然的dp 设 \(f[i][j][k]\) 为前 \(i\) 次,擂台上了 \(j\) 次,空闲容量(背包 - 使用的)为 \(k\) 的概率. 不上擂台的转移:\(f ...

  9. HDFS 操作命令

    本地文件系统创建一个文件,输入带姓名学号信息. 查看新建文件所在目录 查看新建文件内容 将此文件上传到HDFS文件系统上的用户目录 HDFS上查看相应目录 HDFS上查看文件内容 HDFS上查看文件大 ...

  10. 项目中对获取的数据进行下载成Excel表格

    //moment是操作日期的插件  //引入lodash是为了方便操作数据 //xlsx是获取表格的必须插件   import moment from 'moment'; import _ from  ...