searching contents of a string?

N_K

Member
Joined
Oct 10, 2006
Messages
22
Programming Experience
3-5
Hi,

Sorry if this seems simple but I don't seem to be able to find it anywhere.

I want to find out if the word "LoginRegister" exists within the current page URL. Basically this is so that one of my controls can act differently if it is used on a particular page and "LoginRegister" is the name of the folder that page would be in.

so far I have the line

Dim CurrentUrl = Request.ServerVariables("SCRIPT_NAME")

which is fine but I cant seem to find what in my head should be a simple string function.

I'd appreciate some help,

thanks,

NK
 
Ok Ignore that. Ive found the InStr() function.

Oddly I couldnt find it anywhere in the .Net books. silly stuff
 
Perhaps because Instr function isn't a .Net Framework method, but a classic VB legacy method. Use the String.IndexOf method instead.
VB.NET:
Dim CurrentUrl[B] As String[/B] = Request.ServerVariables("SCRIPT_NAME")
If CurrentUrl.IndexOf("LoginRegister") <> -1 Then 'found it..

Thread was moved to ASP.Net forums section.
 
Back
Top