Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How about a Server.URL'DE'Code

Status
Not open for further replies.

Karl Blessing

Programmer
Feb 25, 2000
2,936
US
right now, I am having a problem with the form submited to me, originaly I had it check the variables for a _ , and = and so forth, but for some reason now, I cannot do Instr with &quot;¦&quot; even tho I know its there, it does work if I use the encoded ¦ , which is &quot;%7C&quot; how do I get all the strings to return to normal in my new ASP the form was submited to.<br><br><FONT FACE=monospace><font color=blue><br>' FormStr has 1 fields, &quot;Variable=Value&quot; from the Form Posting<br>'&lt;!-- Grab Parameters --&gt;<br>FormStr = Split(Request.Form, &quot;&&quot;)<br>ReDim FrmCol(UBound(FormStr),2)<br><br>'FormCol now has 2 feilds &quot;Variable&quot;, &quot;Value&quot;<br>'&lt;!-- Grab Variable and Value --&gt;<br>for i = LBound(FrmCol) to UBound(FrmCol)<br>&nbsp;&nbsp;TmpAry = Split(FormStr(i),&quot;=&quot;)<br>&nbsp;&nbsp;FrmCol(i,0) = TmpAry(0)<br>&nbsp;&nbsp;FrmCol(i,1) = TmpAry(1)<br>next<br><br>'&lt;!-- Grab number of Root Catagories(Heads) --&gt;<br>Number = 0<br>for j = LBound(FrmCol) to UBound(FrmCol)<br><font color=red>&nbsp;&nbsp;rt = Instr(1, FrmCol(j,0), &quot;¦&quot;)-1 '&quot;%7C&quot; works, &quot;¦&quot; doesnt </font><br>&nbsp;&nbsp;'Response.Write &quot;rt: &quot; & rt & &quot;(&quot; & FrmCol(j,0) & &quot;}&lt;BR&gt;&quot; & vbcrlf<br>&nbsp;&nbsp;if rt &gt; 0 then<br>&nbsp;&nbsp;&nbsp;&nbsp;if IsNumeric(Left(FrmCol(j,0), rt)) then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Number = Number + 1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Response.Write FrmCol(j,0) & &quot; {&quot; & FrmCol(j,1) & &quot;}&lt;BR&gt;&quot; & vbcrlf<br>&nbsp;&nbsp;&nbsp;&nbsp;end if<br>&nbsp;&nbsp;else<br>&nbsp;&nbsp;&nbsp;&nbsp;if IsNumeric(FrmCol(j,0)) then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Number = Number + 1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Response.Write FrmCol(j,0) & &quot;&lt;BR&gt;&quot; & vbcrlf<br>&nbsp;&nbsp;&nbsp;&nbsp;end if<br>&nbsp;&nbsp;end if<br>next<br><br>Response.Write Number<br>Response.End<br></font></font><br><br>there is more, but I am just debuging it now, to accept my new namming convention. <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
 
1.In following line, what is this <font color=red>-1</font>?<br>rt = Instr(1, FrmCol(j,0), &quot;¦&quot;)-1 <br><br>2.Here's very simple piece of code which worked(just for testing purposes):<br>&lt;HTML&gt;<br>&lt;HEAD&gt;<br>&lt;META NAME=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 6.0&quot;&gt;<br>&lt;TITLE&gt;&lt;/TITLE&gt;<br>&lt;/HEAD&gt;<br>&lt;BODY&gt;<br>&lt;%dim inp<br>&nbsp;&nbsp;inp = instr(1,request(&quot;charac&quot;),&quot;¦&quot;)<br>&nbsp;&nbsp;Response.Write inp<br><br>%&gt;<br>&lt;form name=&quot;pipe&quot; action=&quot;&quot; method=&quot;post&quot;&gt;<br>&nbsp;&lt;input type=&quot;textbox&quot; name=&quot;charac&quot;&gt;<br>&nbsp;&lt;input type=&quot;submit&quot;&gt;<br>&lt;/form&gt;<br>&lt;/BODY&gt;<br>&lt;/HTML&gt;<br><br>Of course, when you first load the page it'll give you <br>inp = 0
 
I want the Number before the ¦, which is why the -1 is there, to be the length (considering everything is comming from position 0)<br><br>also the Form variable passed isnt going to be just a &quot;Charac&quot; which is why I load the whole thing into an array, it's being decoded for processing, you'd have to see the page it came from to understand what I mean, but the question is simple, how do I allow instr to find a &quot;¦&quot; inside of a URLEncoded form values?, also is URLEncode required for Forms, I know it's required at the bottom of this page, because I append the new data on the end of the URL string. <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
 
I found out I dont even use URLEncode on the page it came from, the submision must have done that. <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
 
Here's another piece of code, which works:<br><br>&lt;HEAD&gt;<br>&lt;TITLE&gt;&lt;/TITLE&gt;<br>&lt;/HEAD&gt;<br>&lt;BODY&gt;<br>&lt;%dim strURL,strDeURL<br>&nbsp;&nbsp;strURL = server.URLEncode(&quot;pipe.asp?pipe=asd¦fasd&quot;)<br>&nbsp;if instr(1,strURL,&quot;%7C&quot;)&lt;&gt; 0 then<br>&nbsp;&nbsp;strDeURL = replace(strURL,&quot;%7C&quot;,&quot;¦&quot;)<br>&nbsp;&nbsp;Response.Write strURL & &quot;&lt;br&gt;&quot; & strDeURL<br>&nbsp;else<br>&nbsp;&nbsp;Response.Write &quot;No pipes were found&quot;<br>&nbsp;end if <br>&nbsp;<br>%&gt;<br><br>&lt;/BODY&gt;<br>&lt;/HTML&gt;<br><br><br>Of course, I don't know the whole task you have to accomplish, but the function Instr() works good when you look either for &quot;%7C&quot; or &quot;¦&quot;
 
um, isnt that what I already do, I want to just look for &quot;¦&quot; not have to look for it's encoded version, if I Cant just see &quot;¦&quot; when I get it from the form, otherwise, I'll just need to find the &quot;%7C&quot;. <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
 
also its annoying because if I try to spit it out to the screen, it shows up in it's encoded mode, does this mean if I had a text box, and I typed in yo¦yo when printing it back out, it'll be a &quot;yo%7Cyo&quot;<br>&nbsp;and I didnt even use any URLEncode on my site that submits the form data. <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
 
Dear Karl,<br><br>If your server is running v5.5 of the scripting engine you could proxy the JScript functions that handle decoding into your VBScript.<br><br>&lt;%@ language=vbscript %&gt;<br>&lt;script language=javascript runat=server&gt;<br>function vb_decodeStr( instr){<br><br>&nbsp;&nbsp;return decodeURIComponent( instr);<br>}<br>&lt;/script&gt;<br><br>&lt;%<br>'this is now vbscript since it is a page block<br><br>dim strURL,strDeURL<br>strURL = server.URLEncode(&quot;pipe.asp?pipe=asd¦fasd&quot;)<br>strDeURL = vb_decodeStr( strUrl)<br>%&gt;<br><br>Good luck<br>-pete
 
I could just use that Javascript, and just run it around the Request.Form right, since it's like a big string? <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
 
um, I keep getting an 'object expected' error. <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
 
Dear Karl,<br><br>That's probably what you get when you are running a version of the scripting engine that does not support the function. Did you check your version?<br><br>ScriptEngineMajorVersion()<br>ScriptEngineMinorVersion()<br><br>Good luck<br>-pete
 
Check the spelling: you could have misspelled name of the function when you called it
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top