1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Weird ASP code behavior driving me crazy

Discussion in 'C#' started by aab1, Mar 3, 2011.

  1. #1
    I have a function that takes a date from a website, converts it to a format the computer can understand and then shows it on my website.
    SEMrush
    In all the test code it works fine, including a page that does just that. But on the main site, the very same function returns the date without a space between the date and time so it shows like 3/3/201110:48:36 AM

    Why would the space mysteriously vanish when I'm using the same source date and same functions?
     
    aab1, Mar 3, 2011 IP
    SEMrush
  2. aab1

    aab1 Member Affiliate Manager

    Messages:
    202
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    38
    #2
    I have one clue, I've found that for some reason the HTML code on the page with the problem is being received in all uppercase but there are no UCase functions on that page. Is it possible that another function working with the HTML variable may be changing it to uppercase? Do functions in ASP work ByVal or ByRef by default? Can you change it like in VB apps?
     
    aab1, Mar 3, 2011 IP
  3. aab1

    aab1 Member Affiliate Manager

    Messages:
    202
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    38
    #3
    Wow that was it, a previous function working with the HTML variable was ByRef by default and changing the original variable to uppercase. I've found that you can use ByVal/ByRef in ASP and changed it to ByVal and everything works.

    All this time I thought I was going crazy.
     
    aab1, Mar 3, 2011 IP
  4. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #4
    I'm not exactly sure how byref or byval would effect how the string is displayed.... and the case of the string wouldn't either....
     
    Last edited: Mar 5, 2011
    camjohnson95, Mar 5, 2011 IP
  5. aab1

    aab1 Member Affiliate Manager

    Messages:
    202
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    38
    #5
    I had a variable called HTML which was set to contain the HTML source code of a website, then I had for example:

    Title = GetData(HTML, "title")

    In the GetData function where it handled the "title" request it would convert the HTML variable ByRef to all uppercase, so from then on HTML was in all uppercase. Then I had:

    TheDate = GetData(HTML, "date")

    This part of the GetData function expects HTML to be in it's original state, but is now in all uppercase due to the previous function, causing the function to not properly find what it's looking for in the HTML.

    So I simply changed the GetData function to have the HTML ByVal which solved the problem.
     
    aab1, Mar 5, 2011 IP
  6. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #6
    I see now....
     
    camjohnson95, Mar 6, 2011 IP
  7. wsrinivas

    wsrinivas Member

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #7
    make sure the data variables are not spelled wrong and also check for the ASP IIS recycle time.
     
    wsrinivas, Mar 16, 2011 IP