checking url for existence of string

Results 1 to 4 of 4

Thread: checking url for existence of string

  1. #1
    Bradley Guest

    Default checking url for existence of string

    Hi, I have a need to populate a variable based on the ip address in the url string. If it is inside the building there is a certain ip address to look for and therefore use that code, else use the other code.<BR><BR>I have tried this cumbersome code:<BR><BR>If isNull(instr(Request.ServerVariables("LOCAL_ADDR") , "132.125")) = False Then<BR>strURL = "" & objRS("ResType") & "/" & objRS("ResFile")<BR> Else<BR> strURL = "" & objRS("ResType") & "/" & objRS("ResFile")<BR> End If

  2. #2
    Bradley Guest

    Default RE: checking url for existence of string

    Oops, wasn&#039;t finished! the ip to check for in the first line should be 132.125!

  3. #3
    Join Date
    Dec 1969

    Default Mostly your code okay...

    But what is the IsNull in there for????<BR><BR>InStr( ... anything ... ) will *NEVER* be Null. Never. So isNull will always return False, and you will *never* get to the ELSE part of your test!<BR><BR>IsNull is *NOT* the same as "is not zero"!!! IsNull really does test to see if there is any value at all there yet. <BR><BR>So, to improve slightly on your code:<BR><BR>&#060;%<BR>strURL = "/webdev/resumes/" & objRS("ResType") & "/" & objRS("ResFile")<BR>If instr(Request.ServerVariables("LOCAL_ADDR"), "132.125") &#062; 0 Then<BR>&nbsp; &nbsp; strURL = "" & strURL<BR>Else<BR>&nbsp; &nbsp; strURL = "" & strURL<BR>End If<BR><BR>

  4. #4
    Join Date
    Dec 1969

    Default what Bill said AND

    how come you don&#039;t like the USA Government ?<BR><BR>:)<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts