Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Nov 2002
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts

    not exactly response.redirect

    I am having a trouble.
    I am writing ststistics code, in order to count number of hits to a list of links in our site.
    All pages r asp.

    The list of links is in asp page which is displayed in one of the frames.
    I'd like that when a user presses a link, the statistics database will be updated, and then I'd like the target of that link (a site) to be opened in a NEW WINDOW.

    I tried calling the counting page in the new window and then opening the site, but then the user sees a blank page (with the counting page file name in the title bar), and then it is replaced with the linked site.

    Basically what I need is that once link is clicked, the database of statistics will be updated and that the user will only see the site in a new window, and not a blank page even for 1 sec.
    I have the counting page working great, it can also be just a sub in another asp page.

    I have some q that may help me solve it:

    1. Is it possible to response.redirect to a site in a new window, and also defining windows properties?This way I can redirect from the counting page. Will the counting page will replace the curent frame?

    2.Is it possible to call a function written in vbscript inside asp tags, from javascript or href? (< href="vb function name">kjkj) ?
    This way I can call the counting part (in a sub), using href, and my problems will be solved. I think

    Thanks

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    the link is a normal link with a target="_blank" attribute.

    Why don't you just put the statistics code on every page instead of trying to make it work with just one page. You would have to reload the main page everytime you would call the stat page.

    Eric

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Why not just use the IIS Log files to count the hits on pages? Why are you writing all this code to get information which is better tracked another way? Or did anyone ever tell you that any good web server logs all the hits (and a lot of other good information) in files that can then be read to find simple things like how many times a page gets hit? I'm not trying to pick on you, I just want to make sure that what you're trying to do wouldn't be simpler if you approached it from a different angle.

    There's even software you can buy to analyse and report the contents of those log files (search for WebTrends).
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #4
    New Coder
    Join Date
    Nov 2002
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts

    That is exactly my q

    A1ien51,
    Thanks.

    1. I do not have to reload the main page everytime I call the stat page.

    2. I can put the stat code in each page as a sub for example, but then I wonder how can I call this sub, from a link.(Actually, it's one of my q above)

    3. Roy, I wish IIS log files could do that. The targets r not pages of my site, they r other sites (external links).

    Thanks

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The targets of the links you want to track aren't on your site but the links are?

    Why not make all the links point to a single local link and pass the real url as a parameter. That single page receiving the link could log the usage and then redirect the user to the link that was passed to it. That way you don't have to add tracking code to all your pages.
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #6
    New Coder
    Join Date
    Nov 2002
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts
    >>The targets of the links you want to track aren't on your site >>but the links are?

    YES.


    Well, that is what I did in the first place. And my problem is:

    All works but when clicking the link, the current displayed page is replaced with the log file (blank page - asp page that updates the usage database), and then the target site is opened (in a new window or not, as I choose), using redirect or another option.

    I just do not want the log file to appear, I need something like "echo off", and the user to see only the target link.

  • #7
    Senior Coder
    Join Date
    Jun 2002
    Location
    41 8' 52" N -95 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think then that your problem is you're outputting HTML. Send this stuff to a pure asp page that has nothing more than:
    Code:
    <%
    Function IsURL(str)
    	Dim iuRegEx
    	Set iuRegEx = New RegExp
    	iuRegEx.Pattern = "(http|ftp|https):\/\/[\w]+(.[\w]+)([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?"
    	IsURL = iuRegEx.Test(str)
    End Function
    
    link = Request.QueryString("L")
    If IsURL(link) Then
         'Code to write the link into your database
         Response.Redirect(link)
    Else
         Response.Redirect("http://badlinksupplied.asp") 'You get what I mean here I'm sure
         'Or better yet just call a subroutine that displays an error message
    End If
    %>
    The only way it could be showing anything before you redirect is if you're providing some kind of output in the form of HTML, text, or whatever...
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)


  •  

    Posting Permissions

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