|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
对用户来说可预见费用、节约费用,可以做到花少钱办大事。由于省去了购买软件和硬件等的前期费用,用户可以租用较高级的应用软件。ASP的收费是根据软件的类型、客制化程度、用户数量、服务期限来定的,对客户来说这笔费用是可以预见的。方便于客户应用软件的升级。数据privatevoidPage_Load(objectsender,System.EventArgse)
{
stringurl="http://localhost/webUserWindowExample/WebForm5.aspx";
System.Net.CookieContainercook=newSystem.Net.CookieContainer();
stringgets=getHTMLByUrlCook(url,refcook,"Get",null,true);
stringstrViewState=System.Text.RegularExpressions.Regex.Replace(gets,"[s*S*]*<inputtype="hidden"name="__VIEWSTATE"value="([^"]*)"[s*S*]*","$1",System.Text.RegularExpressions.RegexOptions.IgnoreCase);
stringparam="__VIEWSTATE="+System.Web.HttpUtility.UrlEncode(strViewState)+"&TextBox1=xxxx&Button1=Button&CheckBox1=on";
strings=a.getHTMLByUrlCook(url,refcook,"POST",param,true);
Response.Write(s);
}
publicstringgetHTMLByUrlCook(stringurl,refSystem.Net.CookieContainercook,stringsMethod,stringParam,boolbAutoRedirect)
{
sMethod=sMethod.ToUpper();
sMethod=sMethod!="POST"?"GET":sMethod;
stringres="";
HttpWebRequestre=(HttpWebRequest)HttpWebRequest.Create(url);
re.CookieContainer=cook;//attachthecookobject
re.Method=sMethod;
//re.AllowAutoRedirect=bAutoRedirect;
//re.UserAgent="Mozilla/4.0(compatible;MSIE6.0;WindowsNT5.2;MyIE2;.NETCLR1.1.4322)";
//
//re.ClientCertificates=newSystem.Security.Cryptography.X509Certificates.X509CertificateCollection();
//re.ClientCertificates=System.Security.Cryptography.X509Certificates.X509Certificate.CreateFromSignedFile();
//re.Timeout=2000;
if(sMethod=="POST")//PostdatatoServer
{
re.ContentType="application/x-www-form-urlencoded";
Byte[]b=System.Text.Encoding.UTF8.GetBytes(Param);
re.ContentLength=b.Length;
try
{
StreamoSRe=re.GetRequestStream();
oSRe.Write(b,0,b.Length);
oSRe.Close();
oSRe=null;
}
catch(Exception)
{
re=null;
return"-1";
}
}
HttpWebResponserep=null;
StreamoResponseStream=null;
StreamReaderoSReader=null;
try
{
rep=(HttpWebResponse)re.GetResponse();
oResponseStream=rep.GetResponseStream();
oSReader=newStreamReader(oResponseStream,System.Text.Encoding.Default);
res=oSReader.ReadToEnd();
}
catch(System.Net.WebExceptione)
{
//res="-1";
res=e.ToString();
}
if(rep!=null)
{
rep.Close();
rep=null;
}
if(oResponseStream!=null)
{
oResponseStream.Close();
oResponseStream=null;
}
if(oSReader!=null)
{
oSReader.Close();
oSReader=null;
}
re=null;
returnres;
}
</p>asp可以使用微软的activeX使得网页功能无比强大,不过安全性也较差,而且是基于的windows服务器,所以性能稳定性也一般 |
|