求高手帮忙解决 c# 模拟登录带验证码 总提示验证码错误

问题描述

c#模拟登录带验证码总提示验证码错误,这个网站以前没有加验证码的时候时可以正常模拟登录进去的。这是以前的代码:stringstr_ratk="";doubledttick=this.cConvertDateTimeInt(System.DateTime.Now);result=HttpHelper.GetHtml("http://www.plateno.com/p/nlogin.html?_="+dttick.ToString()+"");Regexrgeratk=newRegex(@"ratk""sw*=""w*"">",RegexOptions.Compiled);//ratk"sw*="w*">Matchmratk=rgeratk.Match(result);str_ratk=mratk.Groups[0].ToString().Trim();str_ratk=cGetStringBetween(str_ratk,"value="","">");result="";postData="fromType=0&username=13535127593&password=a111111&atk="+str_ratk.Trim()+"&j_expiredays=0&passwordType=0";result=HttpHelper.GetHtml("http://www.plateno.com/ajax_authentication",postData,true,HttpHelper.CookieContainer);网站加了验证码后参考了一些网友的做法,但总是提示“验证码错误”

解决方案

解决方案二:
验证码不会识别的话,那肯定是错误的。除非网站给留后门
解决方案三:
没打算用程序去识别验证码,我是想把验证码取到后显示出来,然后用手工输入验证吗,为什么这个网站总是提示验证码不正确?我试了一下其它的网站是可以的,不知道这个网站为什么不行//取回验证码privatevoidbtn_Pic_Click(objectsender,EventArgse){this.btn_Pic.Image=doGetImg("http://www.plateno.com/imageToken?id=lgCheckcode&r=0.6810257183387876",sc);}//下面是登录,这里面有个时间戳要处理一下privatevoidbtn_login_Click(objectsender,EventArgse){stringpostData="fromType=0&username=13535080156&password=a111111&lgCheckcode="+txt_code.Text.Trim()+"&atk=7d2f360f00fe4614bb503d9c2dd0f5a9&j_expiredays=0&passwordType=0";byte[]data=System.Text.Encoding.UTF8.GetBytes(postData);stringresult=doPost("http://www.plateno.com/ajax_authentication",data,sc,"utf-8","http://www.plateno.com/login.html?from=sso");}//publicstaticImagedoGetImg(stringUrl,TestCookiebCookie){try{HttpWebRequestmyRequest=(HttpWebRequest)WebRequest.Create(Url.ToString());myRequest.ServicePoint.Expect100Continue=true;myRequest.CookieContainer=bCookie.mycookie;myRequest.Method="GET";myRequest.Timeout=30000;myRequest.KeepAlive=true;//modifybyyangmyRequest.UserAgent="Mozilla/4.0(compatible;MSIE7.0;WindowsNT6.1;Trident/4.0;SLCC2;.NETCLR2.0.50727;.NETCLR3.5.30729;.NETCLR3.0.30729;MediaCenterPC6.0)";myRequest.ContentType="application/x-www-form-urlencoded";HttpWebResponsemyResponse=(HttpWebResponse)myRequest.GetResponse();bCookie.upcookie(myResponse.Cookies);returnBitmap.FromStream(myResponse.GetResponseStream());}catch{returnnull;}}publicstaticstringdoPost(stringUrl,byte[]postData,TestCookiebCookie,StringencodingFormat,Stringreferer){try{HttpWebRequestmyRequest=(HttpWebRequest)WebRequest.Create(Url.ToString());myRequest.CookieContainer=bCookie.mycookie;myRequest.Method="POST";myRequest.Timeout=30000;myRequest.KeepAlive=true;if(referer!="")myRequest.Referer=referer;myRequest.Headers["Cache-control"]="no-cache";myRequest.Headers["Accept-Language"]="zh-cn";myRequest.UserAgent="Mozilla/4.0(compatible;MSIE6.0;WindowsNT5.1;Trident/4.0;GTB7.4;GTB7.1;.NETCLR2.0.50727;.NETCLR3.0.4506.2152;.NETCLR3.5.30729;InfoPath.2)";myRequest.ContentType="application/x-www-form-urlencoded";myRequest.Accept="*/*";if(postData!=null){myRequest.ContentLength=postData.Length;StreamnewStream=myRequest.GetRequestStream();newStream.Write(postData,0,postData.Length);newStream.Close();}HttpWebResponsemyResponse=(HttpWebResponse)myRequest.GetResponse();bCookie.upcookie(myResponse.Cookies);StreamReaderreader=newStreamReader(myResponse.GetResponseStream(),Encoding.GetEncoding(encodingFormat));stringoutdata=reader.ReadToEnd();reader.Close();if(!outdata.Contains("基础连接已经关闭:连接被意外关闭")&&!outdata.Contains("无法连接到远程服务器")&&!outdata.Contains("基础连接已经关闭:接收时发生错误。"))returnoutdata;elsereturn"基础连接已经关闭:连接被意外关闭";}catch(Exceptionex){if(!ex.Message.Contains("基础连接已经关闭:连接被意外关闭")&&!ex.Message.Contains("无法连接到远程服务器")&&!ex.Message.Contains("基础连接已经关闭:接收时发生错误。"))returnex.Message;elsereturn"基础连接已经关闭:连接被意外关闭";}}publicclassTestCookie{publicCookieContainermycookie=newCookieContainer();//定义cookie容器publicObjectobj=newObject();publicbyte[]byt=newbyte[1];publicvoidupcookie(CookieCollectioncookie){for(inti=0;i<cookie.Count;i++){mycookie.Add(cookie[i]);}obj=mycookie;byt=ObjectToBytes(obj);}/**////<summary>///将一个object对象序列化,返回一个byte[]///</summary>///<paramname="obj">能序列化的对象</param>///<returns></returns>publicstaticbyte[]ObjectToBytes(objectobj){using(MemoryStreamms=newMemoryStream()){IFormatterformatter=newBinaryFormatter();formatter.Serialize(ms,obj);returnms.GetBuffer();}}/**////<summary>///将一个序列化后的byte[]数组还原///</summary>///<paramname="Bytes"></param>///<returns></returns>publicobjectBytesToObject(byte[]Bytes){using(MemoryStreamms=newMemoryStream(Bytes)){IFormatterformatter=newBinaryFormatter();returnformatter.Deserialize(ms);}}publicCookieContainergetcookie(){returnmycookie;}}TestCookiesc=newTestCookie();
解决方案四:
一看就知道atk是验证码相关。你atk是固定了。你必须先去登录页面采集这个atk然后去获取验证码。然后提交。
解决方案五:
用fiddler抓包比较几次,看看post的字符串构造对不对如果构造正确,那么就检查headers,看看有没有防盗链处理
解决方案六:
获取验证码时有时会返回cookie,提交的时候要带上.代码好乱,看的头疼
解决方案七:
引用3楼wawd74520的回复:

一看就知道atk是验证码相关。你atk是固定了。你必须先去登录页面采集这个atk然后去获取验证码。然后提交。

这个atk的值我是为了调试方便固定了一下,实际上是每次都有去取这个atk的值,但把这个atk的值加上去后还是报验证码不正确,在帖子的内容里有加atk的,但不知道为什么总是不成功
解决方案八:
sc=newSinaCookie();doGet("http://www.plateno.com/p/nloginxxxxxxxxxx",sc);//登录界面去atkdoGetImg("http://www.plateno.com/imageToken?id=lgCheckcode&r=0.6810257183387876",sc);//验证码获取dopost。。。。登录类似这样。如果你有我的那些类。sc传进去Cookie会自动更新。。。
解决方案:
引用7楼wawd74520的回复:

sc=newSinaCookie();doGet("http://www.plateno.com/p/nloginxxxxxxxxxx",sc);//登录界面去atkdoGetImg("http://www.plateno.com/imageToken?id=lgCheckcode&r=0.6810257183387876",sc);//验证码获取dopost。。。。登录类似这样。如果你有我的那些类。sc传进去Cookie会自动更新。。。

我的大概思路也是这样子,但还是不行,能不能把你的类发一份给我参考一下?感谢!yourname386@163.com
解决方案:
publicstaticstringdoPost(stringUrl,byte[]postData,QQCookiebCookie,StringencodingFormat,Stringreferer,stringProxyStr){try{HttpWebRequestmyRequest=(HttpWebRequest)WebRequest.Create(Url.ToString());if(ProxyStr!=""&&ProxyStr!=null){//设置代理WebProxyproxy=newWebProxy();proxy.Address=newUri(ProxyStr);myRequest.UseDefaultCredentials=true;myRequest.Proxy=proxy;}//myRequest.ServicePoint.Expect100Continue=false;myRequest.CookieContainer=bCookie.mycookie;myRequest.Method="POST";myRequest.Timeout=30000;myRequest.KeepAlive=true;//modifybyyangif(referer!="")myRequest.Referer=referer;myRequest.Headers["Cache-control"]="no-cache";//.CachePolicy=.c"no-cache";//["Cache-control:no-cache"]myRequest.Headers["Accept-Language"]="zh-cn";myRequest.UserAgent="Mozilla/4.0(compatible;MSIE6.0;WindowsNT5.1;Trident/4.0;GTB7.4;GTB7.1;.NETCLR2.0.50727;.NETCLR3.0.4506.2152;.NETCLR3.5.30729;InfoPath.2)";myRequest.ContentType="application/x-www-form-urlencoded";myRequest.Accept="*/*";myRequest.ContentLength=postData.Length;//setRequestHeader(requestHearder,myRequest);StreamnewStream=myRequest.GetRequestStream();newStream.Write(postData,0,postData.Length);newStream.Close();//if(waitTime!=0)//Thread.Sleep(waitTime);HttpWebResponsemyResponse=(HttpWebResponse)myRequest.GetResponse();bCookie.upcookie(myResponse.Cookies);StreamReaderreader=newStreamReader(myResponse.GetResponseStream(),Encoding.GetEncoding(encodingFormat));stringoutdata=reader.ReadToEnd();reader.Close();if(!outdata.Contains("基础连接已经关闭:连接被意外关闭")&&!outdata.Contains("无法连接到远程服务器")&&!outdata.Contains("基础连接已经关闭:接收时发生错误。"))returnoutdata;elsereturn"基础连接已经关闭:连接被意外关闭";}catch(Exceptionex){if(!ex.Message.Contains("基础连接已经关闭:连接被意外关闭")&&!ex.Message.Contains("无法连接到远程服务器")&&!ex.Message.Contains("基础连接已经关闭:接收时发生错误。"))returnex.Message;elsereturn"基础连接已经关闭:连接被意外关闭";}}publicstaticstringdoGet(stringUrl,QQCookiebCookie,StringencodingFormat,StringrefUrl,stringProxyStr){try{HttpWebRequestmyRequest=(HttpWebRequest)WebRequest.Create(Url.ToString());if(ProxyStr!=""&&ProxyStr!=null){//设置代理WebProxyproxy=newWebProxy();proxy.Address=newUri(ProxyStr);myRequest.UseDefaultCredentials=true;myRequest.Proxy=proxy;}myRequest.ServicePoint.Expect100Continue=true;myRequest.CookieContainer=bCookie.mycookie;myRequest.Method="GET";if(refUrl!=null&&refUrl!=string.Empty)myRequest.Referer=refUrl;myRequest.Timeout=6000;myRequest.KeepAlive=true;//modifybyyangmyRequest.UserAgent="Mozilla/4.0(compatible;MSIE7.0;WindowsNT6.1;Trident/4.0;SLCC2;.NETCLR2.0.50727;.NETCLR3.5.30729;.NETCLR3.0.30729;MediaCenterPC6.0)";myRequest.ContentType="application/x-www-form-urlencoded";//setRequestHeader(requestHeaders,myRequest);HttpWebResponsemyResponse=(HttpWebResponse)myRequest.GetResponse();//stringdddd=myResponse.Headers["Set-Cookie"];bCookie.upcookie(myResponse.Cookies);StreamReaderreader=newStreamReader(myResponse.GetResponseStream(),Encoding.GetEncoding(encodingFormat));stringoutdata=reader.ReadToEnd();reader.Close();returnoutdata;}catch(Exceptionex){returnex.Message;}}publicstaticImagedoGetImg(stringUrl,QQCookiebCookie,stringProxyStr){try{HttpWebRequestmyRequest=(HttpWebRequest)WebRequest.Create(Url.ToString());if(ProxyStr!=""&&ProxyStr!=null){//设置代理WebProxyproxy=newWebProxy();proxy.Address=newUri(ProxyStr);myRequest.UseDefaultCredentials=true;myRequest.Proxy=proxy;}myRequest.ServicePoint.Expect100Continue=true;myRequest.CookieContainer=bCookie.mycookie;myRequest.Method="GET";//if(!CommonTool.isEmpty(refUrl))myRequest.Timeout=6000;myRequest.KeepAlive=true;//modifybyyangmyRequest.UserAgent="Mozilla/4.0(compatible;MSIE7.0;WindowsNT6.1;Trident/4.0;SLCC2;.NETCLR2.0.50727;.NETCLR3.5.30729;.NETCLR3.0.30729;MediaCenterPC6.0)";myRequest.ContentType="application/x-www-form-urlencoded";HttpWebResponsemyResponse=(HttpWebResponse)myRequest.GetResponse();bCookie.upcookie(myResponse.Cookies);returnBitmap.FromStream(myResponse.GetResponseStream());}catch//(Exceptionex){returnnull;}}publicclassQQCookie{publicCookieContainermycookie=newCookieContainer();//定义cookie容器publicObjectobj=newObject();publicbyte[]byt=newbyte[1];publicvoidupcookie(CookieCollectioncookie){for(inti=0;i<cookie.Count;i++){mycookie.Add(cookie[i]);}obj=mycookie;byt=ObjectToBytes(obj);}/**////<summary>///将一个object对象序列化,返回一个byte[]///</summary>///<paramname="obj">能序列化的对象</param>///<returns></returns>publicstaticbyte[]ObjectToBytes(objectobj){using(MemoryStreamms=newMemoryStream()){IFormatterformatter=newBinaryFormatter();formatter.Serialize(ms,obj);returnms.GetBuffer();}}/**////<summary>///将一个序列化后的byte[]数组还原///</summary>///<paramname="Bytes"></param>///<returns></returns>publicobjectBytesToObject(byte[]Bytes){using(MemoryStreamms=newMemoryStream(Bytes)){IFormatterformatter=newBinaryFormatter();returnformatter.Deserialize(ms);}}publicCookieContainergetcookie(){returnmycookie;}}

解决方案:
你要先用HttpRequest访问取验证码地址,然后用这个Cookies取登录的页面,然后取到Hidden里的特殊值与Cookies最后把上面的Cookies一起打包发送请求就可以了。
解决方案:
引用9楼wawd74520的回复:

publicstaticstringdoPost(stringUrl,byte[]postData,QQCookiebCookie,StringencodingFormat,Stringreferer,stringProxyStr){try{HttpWebRequestmyRequest=(HttpWebRequest)WebRequest.Create(Url.ToString());if(ProxyStr!=""&&ProxyStr!=null){//设置代理WebProxyproxy=newWebProxy();proxy.Address=newUri(ProxyStr);myRequest.UseDefaultCredentials=true;myRequest.Proxy=proxy;}//myRequest.ServicePoint.Expect100Continue=false;myRequest.CookieContainer=bCookie.mycookie;myRequest.Method="POST";myRequest.Timeout=30000;myRequest.KeepAlive=true;//modifybyyangif(referer!="")myRequest.Referer=referer;myRequest.Headers["Cache-control"]="no-cache";//.CachePolicy=.c"no-cache";//["Cache-control:no-cache"]myRequest.Headers["Accept-Language"]="zh-cn";myRequest.UserAgent="Mozilla/4.0(compatible;MSIE6.0;WindowsNT5.1;Trident/4.0;GTB7.4;GTB7.1;.NETCLR2.0.50727;.NETCLR3.0.4506.2152;.NETCLR3.5.30729;InfoPath.2)";myRequest.ContentType="application/x-www-form-urlencoded";myRequest.Accept="*/*";myRequest.ContentLength=postData.Length;//setRequestHeader(requestHearder,myRequest);StreamnewStream=myRequest.GetRequestStream();newStream.Write(postData,0,postData.Length);newStream.Close();//if(waitTime!=0)//Thread.Sleep(waitTime);HttpWebResponsemyResponse=(HttpWebResponse)myRequest.GetResponse();bCookie.upcookie(myResponse.Cookies);StreamReaderreader=newStreamReader(myResponse.GetResponseStream(),Encoding.GetEncoding(encodingFormat));stringoutdata=reader.ReadToEnd();reader.Close();if(!outdata.Contains("基础连接已经关闭:连接被意外关闭")&&!outdata.Contains("无法连接到远程服务器")&&!outdata.Contains("基础连接已经关闭:接收时发生错误。"))returnoutdata;elsereturn"基础连接已经关闭:连接被意外关闭";}catch(Exceptionex){if(!ex.Message.Contains("基础连接已经关闭:连接被意外关闭")&&!ex.Message.Contains("无法连接到远程服务器")&&!ex.Message.Contains("基础连接已经关闭:接收时发生错误。"))returnex.Message;elsereturn"基础连接已经关闭:连接被意外关闭";}}publicstaticstringdoGet(stringUrl,QQCookiebCookie,StringencodingFormat,StringrefUrl,stringProxyStr){try{HttpWebRequestmyRequest=(HttpWebRequest)WebRequest.Create(Url.ToString());if(ProxyStr!=""&&ProxyStr!=null){//设置代理WebProxyproxy=newWebProxy();proxy.Address=newUri(ProxyStr);myRequest.UseDefaultCredentials=true;myRequest.Proxy=proxy;}myRequest.ServicePoint.Expect100Continue=true;myRequest.CookieContainer=bCookie.mycookie;myRequest.Method="GET";if(refUrl!=null&&refUrl!=string.Empty)myRequest.Referer=refUrl;myRequest.Timeout=6000;myRequest.KeepAlive=true;//modifybyyangmyRequest.UserAgent="Mozilla/4.0(compatible;MSIE7.0;WindowsNT6.1;Trident/4.0;SLCC2;.NETCLR2.0.50727;.NETCLR3.5.30729;.NETCLR3.0.30729;MediaCenterPC6.0)";myRequest.ContentType="application/x-www-form-urlencoded";//setRequestHeader(requestHeaders,myRequest);HttpWebResponsemyResponse=(HttpWebResponse)myRequest.GetResponse();//stringdddd=myResponse.Headers["Set-Cookie"];bCookie.upcookie(myResponse.Cookies);StreamReaderreader=newStreamReader(myResponse.GetResponseStream(),Encoding.GetEncoding(encodingFormat));stringoutdata=reader.ReadToEnd();reader.Close();returnoutdata;}catch(Exceptionex){returnex.Message;}}publicstaticImagedoGetImg(stringUrl,QQCookiebCookie,stringProxyStr){try{HttpWebRequestmyRequest=(HttpWebRequest)WebRequest.Create(Url.ToString());if(ProxyStr!=""&&ProxyStr!=null){//设置代理WebProxyproxy=newWebProxy();proxy.Address=newUri(ProxyStr);myRequest.UseDefaultCredentials=true;myRequest.Proxy=proxy;}myRequest.ServicePoint.Expect100Continue=true;myRequest.CookieContainer=bCookie.mycookie;myRequest.Method="GET";//if(!CommonTool.isEmpty(refUrl))myRequest.Timeout=6000;myRequest.KeepAlive=true;//modifybyyangmyRequest.UserAgent="Mozilla/4.0(compatible;MSIE7.0;WindowsNT6.1;Trident/4.0;SLCC2;.NETCLR2.0.50727;.NETCLR3.5.30729;.NETCLR3.0.30729;MediaCenterPC6.0)";myRequest.ContentType="application/x-www-form-urlencoded";HttpWebResponsemyResponse=(HttpWebResponse)myRequest.GetResponse();bCookie.upcookie(myResponse.Cookies);returnBitmap.FromStream(myResponse.GetResponseStream());}catch//(Exceptionex){returnnull;}}publicclassQQCookie{publicCookieContainermycookie=newCookieContainer();//定义cookie容器publicObjectobj=newObject();publicbyte[]byt=newbyte[1];publicvoidupcookie(CookieCollectioncookie){for(inti=0;i<cookie.Count;i++){mycookie.Add(cookie[i]);}obj=mycookie;byt=ObjectToBytes(obj);}/**////<summary>///将一个object对象序列化,返回一个byte[]///</summary>///<paramname="obj">能序列化的对象</param>///<returns></returns>publicstaticbyte[]ObjectToBytes(objectobj){using(MemoryStreamms=newMemoryStream()){IFormatterformatter=newBinaryFormatter();formatter.Serialize(ms,obj);returnms.GetBuffer();}}/**////<summary>///将一个序列化后的byte[]数组还原///</summary>///<paramname="Bytes"></param>///<returns></returns>publicobjectBytesToObject(byte[]Bytes){using(MemoryStreamms=newMemoryStream(Bytes)){IFormatterformatter=newBinaryFormatter();returnformatter.Deserialize(ms);}}publicCookieContainergetcookie(){returnmycookie;}}

加了你的类,还是验证码不正确QQCookiesc;stringstr_ratk="";privatevoidbtn_Pic_Click(objectsender,EventArgse){sc=newQQCookie();doubledttick=this.cConvertDateTimeInt(System.DateTime.Now);stringresult="";result="http://www.plateno.com/p/nlogin.html?_="+dttick.ToString()+"";result=doGet(result,sc,"utf-8","","");//登录界面去atk//Regexrgeratk=newRegex(@"ratk""sw*=""w*"">",RegexOptions.Compiled);//ratk"sw*="w*">Matchmratk=rgeratk.Match(result);str_ratk=mratk.Groups[0].ToString().Trim();str_ratk=cGetStringBetween(str_ratk,"value="","">");this.btn_Pic.Visible=false;this.btn_Pic.Image=doGetImg("http://www.plateno.com/imageToken?id=lgCheckcode&r=0.6810257183387876",sc,"");this.btn_Pic.Visible=true;}privatevoidbtn_tb_Click(objectsender,EventArgse){stringpostData="";stringresult="";strUser="13535080156";//13535127593userPWD="a111111";//postData="fromType=0&username="+strUser.Trim()+"&password="+userPWD+"&lgCheckcode="+txt_code.Text.Trim()+"&atk="+str_ratk.Trim()+"&j_expiredays=0&passwordType=0";postData="fromType=0&username=13535127593&password=a1&lgCheckcode="+txt_code.Text.Trim()+"&atk="+str_ratk.Trim()+"&j_expiredays=0&passwordType=0";byte[]data=System.Text.Encoding.UTF8.GetBytes(postData);result=doPost("http://www.plateno.com/ajax_authentication",data,sc,"utf-8","http://www.plateno.com/login.html?from=sso","");txt_textcode.Text=result;//提示:验证码不正确}
解决方案:
引用10楼wyd1520的回复:

你要先用HttpRequest访问取验证码地址,然后用这个Cookies取登录的页面,然后取到Hidden里的特殊值与Cookies最后把上面的Cookies一起打包发送请求就可以了。

这句怎么理解?然后取到Hidden里的特殊值与Cookies最后把上面的Cookies一起打包发送请求就可以了
解决方案:
这种网站没这么简单的。去把head什么的都弄弄。Cookie弄成stringCookie一个个取。

时间: 2024-09-13 13:12:24

求高手帮忙解决 c# 模拟登录带验证码 总提示验证码错误的相关文章

eclipse+gradle build过程中出现此问题 求高手帮忙解决下

问题描述 eclipse+gradle build过程中出现此问题 求高手帮忙解决下 Execution failed for task ':PunkHoo:packageAllDebugClassesForMultiDex'. java.util.zip.ZipException: duplicate entry: android/support/v4/internal/view/ SupportMenu.class

html5-【菜鸟问题】两组轮播JS代码有冲突,问题很多!求高手帮忙解决

问题描述 [菜鸟问题]两组轮播JS代码有冲突,问题很多!求高手帮忙解决 上图JS代码如下: [code=javascript] //首页顶部轮播 var i = 0; jummper(); function jummper() { $(".car ul li").eq(i).find("img").css("left", "-100%"); //滑动图在左边-100%准备 $(".car ul li").e

VS2012的Windows Service程序打包成exe后安装,但是在进程管理中找不到这个服务,是怎么回事呢???求高手帮忙解决,谢谢!!在线等……

问题描述 VS2012的WindowsService程序打包成exe后安装,但是在进程管理中找不到这个服务,是怎么回事呢???求高手帮忙解决,谢谢!!在线等-- 解决方案 解决方案二:windowsservice安装过程中,不光是复制可执行文件,很关键的一步是需要自定义的,就是注册服务,并且启动服务.注册要用到installutil,启动就用netstartxxxxxx解决方案三:我是用这种方法配置打包的,以前有个项目也是按这种方法配置打包成功运行没有问题,不知道这次是怎么回事http://bl

Developer可以正常连接到远程数据库,单tomcat的项目里却连接不上,求高手帮忙解决。

问题描述 我的Developer配置监听,连接VPN可以远程访问到数据库.但是我启动tomcat里面的项目却访问不了远程的数据库,SqlMap文件里的连接配置完全没问题.求高手帮忙解决啊. 解决方案 解决方案二:还是检查连接配置.解决方案三:你怎么访问的至少贴出来看下吧,报错吗?还有配置也发一下看看解决方案四:报错信息贴出来兄弟们才能帮你分析解决方案五:连接不上至少有个反馈吧

是否缺少 using 指令或程序集引用? 求高手帮忙解决

问题描述 usingSystem;usingSystem.Data;usingSystem.Configuration;usingSystem.Collections;usingSystem.Web;usingSystem.Web.Security;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Web.UI.HtmlControls;usi

跪求高手帮忙解决sql server2005连不上

问题描述 这是我的代码<%@pagecontentType="text/html;charset=gb2312"%><%@pageimport="java.sql.*"%><html><body><%Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");Stringurl="jdbc:sqlserver://loc

求高手帮忙解决文件流的问题

问题描述 别人传给我一个byte[]类型的文件流给我我现在怎么解析输出对应的文件或流现在弄了一下总是在文件里面输出原来的字节流何解啊 解决方案 解决方案二:你现在有一个byte[]数组,System.out.println(newString(byte[]));这样就可以了.解决方案三: 解决方案四:别人传给我的是一串Byte[]不是字符串呀怎么输出对应的文件格式如.txt.docx等解决方案五:额,我一开始看错了.你可以先Stringstr=newString("你的byte数组")

方法-请教一个模拟登陆的问题!!求高手帮忙!!

问题描述 请教一个模拟登陆的问题!!求高手帮忙!! 模拟登陆需求具体流程是这样的: 1.访问登陆页面. 2.返回页面里 某个 input的值(用于每次登陆传参用,此值为动态的,每次打开页面都会变化). 3.模拟post登陆提交. 4.接收返回页面. ---------------- 实现过程与问题: 1.正常模拟访问页面. 2.正常返回页面,(抓取所需动态值). 3.模拟提交(问题出现在这,因为1已经访问过了页面,而3步的模拟提交还要访问一次,所有造成了所需的 input动态值发生变化了.) 问

java spring junit-java junit测试报错找不到自己定义的xml文件 跪求各位高手帮忙解决一下

问题描述 java junit测试报错找不到自己定义的xml文件 跪求各位高手帮忙解决一下 eclipse下junit测试时遇到如下错误,错误内容如下: at jp.co.dgic.eclipse.jdt.internal.junit.runner.DJUnitRunner.main(DJUnitRunner.java:49) caused by:org.springframework.beans.factory. BeanDefinitionStoreException:IoException