Connecting Tech Pros Worldwide Help | Site Map

Parse Server Variable

Newbie
 
Join Date: Jul 2008
Location: NewYork
Posts: 21
#1: Aug 18 '09
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
tlhintoq's Avatar
Moderator
 
Join Date: Mar 2008
Location: Arizona, USA
Posts: 1,743
#2: Aug 18 '09

re: Parse Server Variable


You're going to have to give the volunteers here a little more to go on. Some of the code in question helps.

Quote:
I have a server variable... LOGON_USER
Nobody here will know if your variable is a string, an int, a custom object...
Frinavale's Avatar
Site Moderator
 
Join Date: Oct 2006
Location: The Great White North
Posts: 5,066
#3: Aug 18 '09

re: Parse Server Variable


If it's a string then you can just use a regular expression to extract whatever it is you need from it.
Newbie
 
Join Date: Jul 2008
Location: NewYork
Posts: 21
#4: Aug 24 '09

re: Parse Server Variable


The variable LOGON_USER is in format: acct01\username. I only need the information after the backslash to pass through a URL (username).
tlhintoq's Avatar
Moderator
 
Join Date: Mar 2008
Location: Arizona, USA
Posts: 1,743
#5: Aug 24 '09

re: Parse Server Variable


Quote:

Originally Posted by doublestack View Post

The variable LOGON_USER is in format: acct01\username. I only need the information after the backslash to pass through a URL (username).

Did you try Frinavale's suggestion?
Quote:

Originally Posted by Frinavale

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
Newbie
 
Join Date: Jul 2008
Location: NewYork
Posts: 21
#6: Sep 8 '09

re: Parse Server Variable


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?
Frinavale's Avatar
Site Moderator
 
Join Date: Oct 2006
Location: The Great White North
Posts: 5,066
#7: Sep 8 '09

re: Parse Server Variable


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
tlhintoq's Avatar
Moderator
 
Join Date: Mar 2008
Location: Arizona, USA
Posts: 1,743
#8: Sep 8 '09

re: Parse Server Variable


Quote:

Originally Posted by doublestack View Post

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?

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
Newbie
 
Join Date: Jul 2008
Location: NewYork
Posts: 21
#9: Sep 11 '09

re: Parse Server Variable


Thanks for the info Frinny and Tlhintoq! I will give it a try and left you know if I run into any problems
Reply

Tags
aspx, parse, server, url, variable