问题描述
因为第一次碰vb.net。不清楚验证在哪写,怎么写。有这几个登录文件login.aspxlogin.aspx.resxlogin.aspx.vblogin.aspx提交的代码是这么写的,点击按钮,好像直接就提交了。<formid="Form1"method="post"runat="server"><asp:imagebuttonid="btnLogin"tabIndex="3"runat="server"ImageUrl="image/main/login_icon.gif"></asp:imagebutton><ahref="#"OnMouseOut="na_restore_img_src('login_icon','document')"OnMouseOver="na_change_img_src('login_icon','document','images/login_icon_a.gif',true)">
login.aspx.vb代码PrivateSubgLoginCheck()DimiCntAsIntegerDimrvAsLongDimdChngDateAsDateDimiWrngNumb,num,num2AsIntegerDimJUMIN_NUMB,bymdAsStringDiminputDesionDimlogin_flagAsStringDimli_rv,login_Error_msgAsStringOnErrorGoToascErrli_rv=""li_rv=AmsAuth.PassCheck(Trim(txtEmpNo.Text),Trim(txtPwd.Text),"MQ04",Request.UserHostAddress)'인증서버User_idCheck(2003.12.22ByNGJ.)num=Len(Trim(li_rv))num2=num-975login_flag=Trim(Left(li_rv,2))''login_Error_msg=Replace(Trim(Left(li_rv,num)),vbCrLf,"")...
想把用户名写成这样的样式,需要怎么写VB.NETExample:DimsbAsStringBuilder=NewStringBuilder(_HttpUtility.HtmlEncode(input))sb.Replace("<b>","<b>")sb.Replace("</b>","<b>")sb.Replace("<i>","<i>")sb.Replace("</i>","</i>")Response.Write(sb.ToString())
解决方案
解决方案二:
不知道你要写成什么样[code=VB.NE]DimsbAsStringBuilder=NewStringBuilder()sb.Replace("<b>","<b>")sb.Replace("</b>","<b>")sb.Replace("<i>","<i>")sb.Replace("</i>","</i>")DimnewstrasHttpUtility.HtmlEncode(sb)T[/code]
解决方案三:
不知道你要写成什么样DimsbAsStringBuilder=NewStringBuilder()sb.Replace("<b>","<b>")sb.Replace("</b>","<b>")sb.Replace("<i>","<i>")sb.Replace("</i>","</i>")DimnewstrasHttpUtility.HtmlEncode(sb)
解决方案四:
StringmyEncodedString=HttpUtility.HtmlEncode(sb.ToString());StringWritermyWriter=newStringWriter();HttpUtility.HtmlDecode(myEncodedString,myWriter);Response.Write(myWriter.ToString())
解决方案五:
HtmlEncode():html编码HtmlDecode():html解码楼主代码里的形如:sb.Replace("<b>","<b>")其实就是html解码,直接用HtmlDecode方法就行了。
解决方案六:
引用楼主sk3wksksk3jsdj的回复:
因为第一次碰vb.net。不清楚验证在哪写,怎么写。有这几个登录文件login.aspxlogin.aspx.resxlogin.aspx.vblogin.aspx提交的代码是这么写的,点击按钮,好像直接就提交了。HTMLcode<formid="Form1"method="post"runat="server"><asp:imagebuttoni……
replace干什么。。。直接解码就可以了。。。
解决方案七:
还是不太明白,,能加我Q895898970说一下吗,,谢谢