473,385 Members | 1,267 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Help removing special character(s) from url variable

I am calling a variable from an aspx page (LOGON_USER) into a url and need to remove the special character "\" so the user can be logged in correctly.

I am using:

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. location.replace("http://testsite.com:1001/forms/html/testinstance.html?vsuccess=" + "<%=Request.ServerVariables["LOGON_USER"]%>","iframe1");
  3. </script>
  4.  
  5.  
It pulls the information correctly but I would like to remove the domain and \ from the url. Eg: currently (acct01\sams), would like (sams) or (acct01sams)

Thanks!
Jul 30 '09 #1
14 6382
Dormilich
8,658 Expert Mod 8TB
I see no backslash in the url... (a single backslash will automaticly escape the following character or insert the appropriate special character)
Jul 30 '09 #2
The backslash is in the server variable that is called in the URL (LOGON_USER)
The variable (LOGON_USER) = acct...\.... based on the user accessing this page.
Eg: http://testsite.com:1001/forms/html/...ss=acct01\sams

In IE, it replaces the backslash with a square and removes the first s...like this:
Expand|Select|Wrap|Line Numbers
  1. http://testsite.com:1001/forms/html/testinstance.html?vsuccess=acct01ams
I need to know how to remove that and/or the whole "acct01\" part. Thanks!
Jul 30 '09 #3
Dormilich
8,658 Expert Mod 8TB
@doublestack
that's because \s is a special char. before you pass the variable you need to escape the backslash (you'll probably need to do that on the server).
Jul 30 '09 #4
Is there any other methods of removing/parsing this out, without having to do it on the server side? Was hoping for a possible JavaScript or similar solution
Jul 30 '09 #5
Dormilich
8,658 Expert Mod 8TB
the problem is, once you're in Javascript, the string is already parsed. so there's actually no way to alter the original string in Javascript.
Jul 31 '09 #6
I am pulling the data from a wss site using designer on a custom aspx page...since I am only using javascript to redirect the page to a new url using that variable, would it be possible to parse it first? Thanks for your help on this!
Aug 3 '09 #7
Dormilich
8,658 Expert Mod 8TB
I don't see any possibility in JS. when you print out the url through ASP you certainly need to urlencode it.
Aug 3 '09 #8
Ok, how would I go about doing that before redirecting the page?
Aug 4 '09 #9
Dormilich
8,658 Expert Mod 8TB
that depends on how you compose the URL.
Aug 4 '09 #10
Using the example url I gave previously:
Expand|Select|Wrap|Line Numbers
  1. ("http://testsite.com:1001/forms/html/testinstance.html?vsuccess=" + "<%=Request.ServerVariables["LOGON_USER"]%>","iframe1"); 
  2.  
What would be the best way to parse/encode that special character out of the server variable...a little new to this so any suggestions/examples would be appreciated.
Aug 5 '09 #11
Dormilich
8,658 Expert Mod 8TB
because I have no idea of ASP I can't tell, but there should be a method/function that does that. (I could be of help if it were PHP...)
Aug 5 '09 #12
PHP has to be done server side to work right?
Aug 5 '09 #13
Dormilich
8,658 Expert Mod 8TB
@doublestack
yes, as does ASP.

...............
Aug 5 '09 #14
Thanks for your input and time!
Aug 6 '09 #15

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Roy W. Andersen | last post by:
I've been searching google about this for days but can't find anything, so I'm hoping someone here can help me out. I'm trying to create zip-files without needing the zip-file extension in PHP,...
2
by: matt | last post by:
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give...
2
by: Mizrandir | last post by:
Hello, I'm a newbie with Python and there are some things I don't understand of os.system. I've managed to write a script that works in order to test some things: import os...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
8
by: drose0927 | last post by:
Please help! I can't get my program to exit if the user hits the Escape button: When I tried exit(EXIT_SUCCESS), it wouldn't compile and gave me this error: Parse Error, expecting `'}''...
1
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am...
16
by: ^MisterJingo^ | last post by:
Hi all, I have a variable called root which contains (E:\Web\Websites\fileBrowse\) and then I have a variable called path which uses root, and adds directories on to it (this is part of a file...
4
by: feucos | last post by:
Hi all, I am new to these so plz never mind if this is funny. here is my problem : Table : moody Column : Title
3
KevinADC
by: KevinADC | last post by:
Purpose The purpose of this article is to discuss the difference between characters inside a character class and outside a character class and some special characters inside a character class....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.