惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The GitHub Blog
The GitHub Blog
Jina AI
Jina AI
月光博客
月光博客
博客园 - Franky
小众软件
小众软件
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
V
Visual Studio Blog
有赞技术团队
有赞技术团队
V
V2EX
IT之家
IT之家
阮一峰的网络日志
阮一峰的网络日志
Stack Overflow Blog
Stack Overflow Blog
H
Help Net Security
Apple Machine Learning Research
Apple Machine Learning Research
腾讯CDC
D
DataBreaches.Net
Hugging Face - Blog
Hugging Face - Blog
Martin Fowler
Martin Fowler
罗磊的独立博客
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
WordPress大学
WordPress大学
C
Check Point Blog
Microsoft Azure Blog
Microsoft Azure Blog
Microsoft Security Blog
Microsoft Security Blog

博客园 - microtea

Jmeter多机联合产生负载 (转) 【转载】关于Java文件路径问题 - microtea - 博客园 安装CVSNT UTF-8的繁体与简体转换 - microtea - 博客园 利用MSSQL sp自制未公开的加密函数(转) wap开发的点小经验 no suitable driver java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]对象名 'xxx' 无效 关于临时表的个人经验 - microtea - 博客园 java的对像克隆 在Redhat9上安装Oracle 9.2 SQL中的单记录函数 常用javascript Java:int 和 String 互相转换的多种方法 JAVA:Duplicate name in Manifest: Class-Path ServerVariables 集合环境变量列表 初步的对防盗连接的方法的设想 在asp.net中对web.config内容的添加 Asp.net(C#)中基于Forms验证的角色(用户组)验证授权过程
关于The underlying connection was closed
microtea · 2005-05-17 · via 博客园 - microtea

我在做信用卡的连接时发现在如果服务器有防火墙就会有这样的问题.只要把WebRequest的地址叫网络管理员加入到系统的网络防火墙就行了.

string result = ""
string strPost = 
"x_login=YOUR-LOG-IN-ID&x_tran_key=YOUR-TRANSACTION-KEY&x_method=CC&x_type=AUTH_CAPTURE&x_amount=1.00&x_delim_data=TRUE&x_delim_char=|&x_relay_response=FALSE&x_card_num=4111111111111111&x_exp_date=052005&x_test_request=TRUE&x_version=3.1"




// Create a new request to the mentioned URL. 
HttpWebRequest objRequest = 
(HttpWebRequest)WebRequest.Create(
"https://certification.authorize.net/gateway/transact.dll"); 


// objRequest.Proxy= new WebProxy("8.3.8.101"); 
objRequest.Method = "POST"
objRequest.ContentLength 
= strPost.Length; 
objRequest.ContentType 
= "application/x-www-form-urlencoded"

string error=""
StreamWriter myWriter 
= null
// try 
// { 
myWriter = new StreamWriter(objRequest.GetRequestStream()); 
myWriter.Write(strPost); 
// } 
// catch (Exception ex) 
// { 
// error=ex.Message; 
// } 
// finally 
// { 
myWriter.Close(); 
// }