By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,474 Members | 966 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,474 IT Pros & Developers. It's quick & easy.

Parse Server Variable

P: 21
I have a server variable that is being called from an aspx page in a WSS site. I need to find a way to remove part of the variable before passing it to the URL. The server variable is LOGON_USER... TIA
Aug 18 '09 #1
Share this Question
Share on Google+
8 Replies


tlhintoq
Expert 2.5K+
P: 3,525
You're going to have to give the volunteers here a little more to go on. Some of the code in question helps.

I have a server variable... LOGON_USER
Nobody here will know if your variable is a string, an int, a custom object...
Aug 18 '09 #2

Frinavale
Expert Mod 5K+
P: 9,731
If it's a string then you can just use a regular expression to extract whatever it is you need from it.
Aug 18 '09 #3

P: 21
The variable LOGON_USER is in format: acct01\username. I only need the information after the backslash to pass through a URL (username).
Aug 24 '09 #4

tlhintoq
Expert 2.5K+
P: 3,525
@doublestack
Did you try Frinavale's suggestion?
If it's a string then you can just use a regular expression to extract whatever it is you need from it.
You could also use the String.Split method which will give you an array of strings
Aug 24 '09 #5

P: 21
Sorry for the delay in response, was on vacation...

I have never used the String.Split Method and am unfamiliar with its use. Can you give an example of how it is used to parse data out of a variable?
Sep 8 '09 #6

Frinavale
Expert Mod 5K+
P: 9,731
Doublestack,

This is very simple string manipulation. You can use Regular Expressions (which are a little more complicated and you could probably avoid in this case) or use the String.Split() method. (Here's a link that shows how to use regular expressions in JavaScript)

The String.Split() method returns an array of strings by spliting the string based on a delimiter provided...

So if mystring contains "acct01\username"...then you would split on "\" and the array returned would be ["acct01',"username"].

I'd link you to the MSDN library for help on the String class but I can't access it right now.

Here's a link to the JavaScript string.split() method....you can even try using the string.split() method before using it in your code if you want.

String manipulation is one of the first things you learn as a programmer...it's one of the favorite things for tests and stuff at school. You really should familiarize yourself with it.

-Frinny
Sep 8 '09 #7

tlhintoq
Expert 2.5K+
P: 3,525
@doublestack
One of the best places to see how something like this is to be used and to get an explanation is the source.
http://msdn.microsoft.com/en-us/libr...ing.split.aspx
Sep 8 '09 #8

P: 21
Thanks for the info Frinny and Tlhintoq! I will give it a try and left you know if I run into any problems
Sep 11 '09 #9

Post your reply

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