problem on back button

Discussion in 'ASP .Net' started by baroque Chou, Jul 7, 2006.

  1. baroque Chou

    baroque Chou Guest

    The purpose is simple, I want to display a list of photo thumbnails,
    and each has it's own access level defined, only authorized internet
    user can view the full size photo.
    in order to achieve this, I write line of code in the codefile to judge
    whether the current user has right to view further, and if not, say,
    RegisterStartupScript("startupScript", "<script
    language=JavaScript>alert('you don't have right to
    view!');</script>");
    This works fine when the user click the unauthorized photo with the
    alert jumped, while the user move on to other photos that is
    accessable, the page turn to the full size photo, when he or she try to
    click the back button on the browers, the alert jumped again which is
    not what I want.
    it may be caused by the startup script, is there any solution as to
    achieve this purpose ?
     
    baroque Chou, Jul 7, 2006
    #1
    1. Advertising

  2. The best thing would be add the script to the click event of the image if it
    is not accessable. This way the script ONLY fires if the image is clicked.

    You can add the script by doing something like:

    myImage.Attributes.Add("click","alert('You are not authorized to view this
    image.')");

    --
    -Demetri


    "baroque Chou" wrote:

    > The purpose is simple, I want to display a list of photo thumbnails,
    > and each has it's own access level defined, only authorized internet
    > user can view the full size photo.
    > in order to achieve this, I write line of code in the codefile to judge
    > whether the current user has right to view further, and if not, say,
    > RegisterStartupScript("startupScript", "<script
    > language=JavaScript>alert('you don't have right to
    > view!');</script>");
    > This works fine when the user click the unauthorized photo with the
    > alert jumped, while the user move on to other photos that is
    > accessable, the page turn to the full size photo, when he or she try to
    > click the back button on the browers, the alert jumped again which is
    > not what I want.
    > it may be caused by the startup script, is there any solution as to
    > achieve this purpose ?
    >
    >
     
    =?Utf-8?B?RGVtZXRyaQ==?=, Jul 7, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sylvia sil
    Replies:
    1
    Views:
    628
    Curt_C [MVP]
    Dec 29, 2004
  2. Chicagoboy27

    image button as a back button

    Chicagoboy27, Oct 26, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    2,030
    Chicagoboy27
    Oct 30, 2006
  3. phancey
    Replies:
    3
    Views:
    2,595
  4. Author
    Replies:
    6
    Views:
    3,116
    George
    Jan 22, 2009
  5. Useful Info

    Firefox back button takes me back 2 pages.

    Useful Info, Jun 3, 2007, in forum: Javascript
    Replies:
    0
    Views:
    348
    Useful Info
    Jun 3, 2007
Loading...

Share This Page