If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > URL Encoding

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-27-04, 00:16
sachin_mt sachin_mt is offline
Registered User
 
Join Date: Jan 2003
Posts: 106
Post URL Encoding

Hi,

I need to pass a url to a javascript function.Do i need to enclode the url before sending to the java script function,if so how shall i do it in ASP.

<Script language="javascript">
function process_url(lurl)
{
document.frm.action=lurl;
document.frm.submit();
}
</script>

<%
dim a
url="http://www.google.com"
%>
<input type="button" onclick="process_url('<%=url%>')">

this example shows passing url hotmail.com but actually i need to pass urls stored in the database.
__________________
Sachi
Reply With Quote
  #2 (permalink)  
Old 04-27-04, 00:39
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
I don't think you will need to as it will be encoded by the browser itself won't it??

If you do need to here is the function to encode urls Server.HTMLEncode(url)

Last edited by rokslide; 04-27-04 at 00:43.
Reply With Quote
  #3 (permalink)  
Old 04-27-04, 00:42
sachin_mt sachin_mt is offline
Registered User
 
Join Date: Jan 2003
Posts: 106
i donno

I donno,thats why I am asking you guys,I have to be sure with it.

anyone who have done this earlier,pl. respond.
__________________
Sachi
Reply With Quote
  #4 (permalink)  
Old 04-27-04, 00:45
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
really it should only depend on the urls you could be using... for example are you having a url of

http://www.myweb.com/test.asp&myName=Farmer John

or would it be....

http://www.myweb.com/test.asp&myName=Farmer%20John

if it is the former you would need to encode, if the later you shouldn't need to.... btw, check the edit above for the other part of the answer....
Reply With Quote
  #5 (permalink)  
Old 04-27-04, 03:23
sachin_mt sachin_mt is offline
Registered User
 
Join Date: Jan 2003
Posts: 106
yes

I got the answer I am using Server.URLEncode function
__________________
Sachi
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On