Blocking mouse right click....

Discussion in 'ASP .Net' started by Veeresh, Jul 8, 2004.

  1. Veeresh

    Veeresh Guest

    In my asp.net application I want to block mouse right click on my web pages.
    That means instead of popup menu I may just display some message or no
    message at all.
    Hot to do that?
    Thanks,
    Veer
    Veeresh, Jul 8, 2004
    #1
    1. Advertising

  2. > Hot to do that?

    Not to do that.

    No doubt you want to protect some HTML or images in your pages, right?
    Forget it. Any web developer worth his salt know that a browser by
    definition DOWNLOADS COPIES of documents, images, etc. Once the user sees
    them, a copy already exists on their machine. It can easily be opened in
    NotePad from the Temporary Internet Files folder, or viewed in any of a
    half-dozen other ways. Only amateurs prevent right-clicking. And you're not
    an amateur, right?

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    Big things are made up
    of lots of little things.

    "Veeresh" <> wrote in message
    news:...
    > In my asp.net application I want to block mouse right click on my web

    pages.
    > That means instead of popup menu I may just display some message or no
    > message at all.
    > Hot to do that?
    > Thanks,
    > Veer
    >
    >
    Kevin Spencer, Jul 8, 2004
    #2
    1. Advertising

  3. Veeresh

    Veeresh Guest

    No. Thats not correct. I am trying to avoid user accessing Back menu in the
    popup menu.
    Veer



    "Kevin Spencer" <> wrote in message
    news:...
    > > Hot to do that?

    >
    > Not to do that.
    >
    > No doubt you want to protect some HTML or images in your pages, right?
    > Forget it. Any web developer worth his salt know that a browser by
    > definition DOWNLOADS COPIES of documents, images, etc. Once the user sees
    > them, a copy already exists on their machine. It can easily be opened in
    > NotePad from the Temporary Internet Files folder, or viewed in any of a
    > half-dozen other ways. Only amateurs prevent right-clicking. And you're

    not
    > an amateur, right?
    >
    > --
    > HTH,
    > Kevin Spencer
    > .Net Developer
    > Microsoft MVP
    > Big things are made up
    > of lots of little things.
    >
    > "Veeresh" <> wrote in message
    > news:...
    > > In my asp.net application I want to block mouse right click on my web

    > pages.
    > > That means instead of popup menu I may just display some message or no
    > > message at all.
    > > Hot to do that?
    > > Thanks,
    > > Veer
    > >
    > >

    >
    >
    Veeresh, Jul 8, 2004
    #3
  4. Veeresh

    Scott Allen Guest

    What if they use the Backspace button?

    I think Kevin's point is that trying to change the way the client's
    browser interface works is almost always a bad idea. If you count on
    disabling browser functionality for your application to work, someone
    will always find a way around it.

    --
    Scott
    http://www.OdeToCode.com

    On Thu, 8 Jul 2004 10:21:32 -0700, "Veeresh" <>
    wrote:

    >No. Thats not correct. I am trying to avoid user accessing Back menu in the
    >popup menu.
    >Veer
    >
    >
    >
    >"Kevin Spencer" <> wrote in message
    >news:...
    >> > Hot to do that?

    >>
    >> Not to do that.
    >>
    >> No doubt you want to protect some HTML or images in your pages, right?
    >> Forget it. Any web developer worth his salt know that a browser by
    >> definition DOWNLOADS COPIES of documents, images, etc. Once the user sees
    >> them, a copy already exists on their machine. It can easily be opened in
    >> NotePad from the Temporary Internet Files folder, or viewed in any of a
    >> half-dozen other ways. Only amateurs prevent right-clicking. And you're

    >not
    >> an amateur, right?
    >>
    >> --
    >> HTH,
    >> Kevin Spencer
    >> .Net Developer
    >> Microsoft MVP
    >> Big things are made up
    >> of lots of little things.
    >>
    >> "Veeresh" <> wrote in message
    >> news:...
    >> > In my asp.net application I want to block mouse right click on my web

    >> pages.
    >> > That means instead of popup menu I may just display some message or no
    >> > message at all.
    >> > Hot to do that?
    >> > Thanks,
    >> > Veer
    >> >
    >> >

    >>
    >>

    >
    Scott Allen, Jul 8, 2004
    #4
  5. Veeresh

    Veeresh Guest

    Thats true. I am looking for options to disable the browser back button
    too!!!
    I am not finding the proper way through code to make sure after processing
    the data in a page and if the use comes back, all posting may happen again.
    I think the right way(professional way) is controlling through code.
    I have the following code at the page_load event to expire the page once the
    user is out of the current page
    Response.Expires = 0
    'Response.Cache.SetNoStore()

    Response.AppendHeader("Pragma", "no-cache")

    It seems the page is not getting expired. Really don't know how to solve it.
    Veer


    "Scott Allen" <bitmask@[nospam].fred.net> wrote in message
    news:...
    > What if they use the Backspace button?
    >
    > I think Kevin's point is that trying to change the way the client's
    > browser interface works is almost always a bad idea. If you count on
    > disabling browser functionality for your application to work, someone
    > will always find a way around it.
    >
    > --
    > Scott
    > http://www.OdeToCode.com
    >
    > On Thu, 8 Jul 2004 10:21:32 -0700, "Veeresh" <>
    > wrote:
    >
    > >No. Thats not correct. I am trying to avoid user accessing Back menu in

    the
    > >popup menu.
    > >Veer
    > >
    > >
    > >
    > >"Kevin Spencer" <> wrote in message
    > >news:...
    > >> > Hot to do that?
    > >>
    > >> Not to do that.
    > >>
    > >> No doubt you want to protect some HTML or images in your pages, right?
    > >> Forget it. Any web developer worth his salt know that a browser by
    > >> definition DOWNLOADS COPIES of documents, images, etc. Once the user

    sees
    > >> them, a copy already exists on their machine. It can easily be opened

    in
    > >> NotePad from the Temporary Internet Files folder, or viewed in any of a
    > >> half-dozen other ways. Only amateurs prevent right-clicking. And you're

    > >not
    > >> an amateur, right?
    > >>
    > >> --
    > >> HTH,
    > >> Kevin Spencer
    > >> .Net Developer
    > >> Microsoft MVP
    > >> Big things are made up
    > >> of lots of little things.
    > >>
    > >> "Veeresh" <> wrote in message
    > >> news:...
    > >> > In my asp.net application I want to block mouse right click on my web
    > >> pages.
    > >> > That means instead of popup menu I may just display some message or

    no
    > >> > message at all.
    > >> > Hot to do that?
    > >> > Thanks,
    > >> > Veer
    > >> >
    > >> >
    > >>
    > >>

    > >

    >
    Veeresh, Jul 8, 2004
    #5
  6. Veeresh

    Curt_C [MVP] Guest

    you CAN'T....
    Fix the code so that the back doesn't break things instead of trying to
    adjust the users browser.

    --
    Curt Christianson
    Owner/Lead Developer, DF-Software
    Site: http://www.Darkfalz.com
    Blog: http://blog.Darkfalz.com


    "Veeresh" <> wrote in message
    news:%...
    > Thats true. I am looking for options to disable the browser back button
    > too!!!
    > I am not finding the proper way through code to make sure after processing
    > the data in a page and if the use comes back, all posting may happen

    again.
    > I think the right way(professional way) is controlling through code.
    > I have the following code at the page_load event to expire the page once

    the
    > user is out of the current page
    > Response.Expires = 0
    > 'Response.Cache.SetNoStore()
    >
    > Response.AppendHeader("Pragma", "no-cache")
    >
    > It seems the page is not getting expired. Really don't know how to solve

    it.
    > Veer
    >
    >
    > "Scott Allen" <bitmask@[nospam].fred.net> wrote in message
    > news:...
    > > What if they use the Backspace button?
    > >
    > > I think Kevin's point is that trying to change the way the client's
    > > browser interface works is almost always a bad idea. If you count on
    > > disabling browser functionality for your application to work, someone
    > > will always find a way around it.
    > >
    > > --
    > > Scott
    > > http://www.OdeToCode.com
    > >
    > > On Thu, 8 Jul 2004 10:21:32 -0700, "Veeresh" <>
    > > wrote:
    > >
    > > >No. Thats not correct. I am trying to avoid user accessing Back menu in

    > the
    > > >popup menu.
    > > >Veer
    > > >
    > > >
    > > >
    > > >"Kevin Spencer" <> wrote in message
    > > >news:...
    > > >> > Hot to do that?
    > > >>
    > > >> Not to do that.
    > > >>
    > > >> No doubt you want to protect some HTML or images in your pages,

    right?
    > > >> Forget it. Any web developer worth his salt know that a browser by
    > > >> definition DOWNLOADS COPIES of documents, images, etc. Once the user

    > sees
    > > >> them, a copy already exists on their machine. It can easily be opened

    > in
    > > >> NotePad from the Temporary Internet Files folder, or viewed in any of

    a
    > > >> half-dozen other ways. Only amateurs prevent right-clicking. And

    you're
    > > >not
    > > >> an amateur, right?
    > > >>
    > > >> --
    > > >> HTH,
    > > >> Kevin Spencer
    > > >> .Net Developer
    > > >> Microsoft MVP
    > > >> Big things are made up
    > > >> of lots of little things.
    > > >>
    > > >> "Veeresh" <> wrote in message
    > > >> news:...
    > > >> > In my asp.net application I want to block mouse right click on my

    web
    > > >> pages.
    > > >> > That means instead of popup menu I may just display some message or

    > no
    > > >> > message at all.
    > > >> > Hot to do that?
    > > >> > Thanks,
    > > >> > Veer
    > > >> >
    > > >> >
    > > >>
    > > >>
    > > >

    > >

    >
    >
    Curt_C [MVP], Jul 8, 2004
    #6
  7. Veeresh

    Veeresh Guest

    Thats good. I will work on fixing the code. Any suggestions why my below
    code is not expiring the page. What I did is added the below code in
    page1.aspx and moved to the next page by clciked event of button1 in page1
    using response.redirect("page2.aspx"). After hitting browser back button I
    am able to navigate back to page1.aspx. I was expecting to get the page
    expired message when I hit the browser back button.
    Veer


    "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    news:...
    > you CAN'T....
    > Fix the code so that the back doesn't break things instead of trying to
    > adjust the users browser.
    >
    > --
    > Curt Christianson
    > Owner/Lead Developer, DF-Software
    > Site: http://www.Darkfalz.com
    > Blog: http://blog.Darkfalz.com
    >
    >
    > "Veeresh" <> wrote in message
    > news:%...
    > > Thats true. I am looking for options to disable the browser back button
    > > too!!!
    > > I am not finding the proper way through code to make sure after

    processing
    > > the data in a page and if the use comes back, all posting may happen

    > again.
    > > I think the right way(professional way) is controlling through code.
    > > I have the following code at the page_load event to expire the page once

    > the
    > > user is out of the current page
    > > Response.Expires = 0
    > > 'Response.Cache.SetNoStore()
    > >
    > > Response.AppendHeader("Pragma", "no-cache")
    > >
    > > It seems the page is not getting expired. Really don't know how to solve

    > it.
    > > Veer
    > >
    > >
    > > "Scott Allen" <bitmask@[nospam].fred.net> wrote in message
    > > news:...
    > > > What if they use the Backspace button?
    > > >
    > > > I think Kevin's point is that trying to change the way the client's
    > > > browser interface works is almost always a bad idea. If you count on
    > > > disabling browser functionality for your application to work, someone
    > > > will always find a way around it.
    > > >
    > > > --
    > > > Scott
    > > > http://www.OdeToCode.com
    > > >
    > > > On Thu, 8 Jul 2004 10:21:32 -0700, "Veeresh" <>
    > > > wrote:
    > > >
    > > > >No. Thats not correct. I am trying to avoid user accessing Back menu

    in
    > > the
    > > > >popup menu.
    > > > >Veer
    > > > >
    > > > >
    > > > >
    > > > >"Kevin Spencer" <> wrote in message
    > > > >news:...
    > > > >> > Hot to do that?
    > > > >>
    > > > >> Not to do that.
    > > > >>
    > > > >> No doubt you want to protect some HTML or images in your pages,

    > right?
    > > > >> Forget it. Any web developer worth his salt know that a browser by
    > > > >> definition DOWNLOADS COPIES of documents, images, etc. Once the

    user
    > > sees
    > > > >> them, a copy already exists on their machine. It can easily be

    opened
    > > in
    > > > >> NotePad from the Temporary Internet Files folder, or viewed in any

    of
    > a
    > > > >> half-dozen other ways. Only amateurs prevent right-clicking. And

    > you're
    > > > >not
    > > > >> an amateur, right?
    > > > >>
    > > > >> --
    > > > >> HTH,
    > > > >> Kevin Spencer
    > > > >> .Net Developer
    > > > >> Microsoft MVP
    > > > >> Big things are made up
    > > > >> of lots of little things.
    > > > >>
    > > > >> "Veeresh" <> wrote in message
    > > > >> news:...
    > > > >> > In my asp.net application I want to block mouse right click on my

    > web
    > > > >> pages.
    > > > >> > That means instead of popup menu I may just display some message

    or
    > > no
    > > > >> > message at all.
    > > > >> > Hot to do that?
    > > > >> > Thanks,
    > > > >> > Veer
    > > > >> >
    > > > >> >
    > > > >>
    > > > >>
    > > > >
    > > >

    > >
    > >

    >
    >
    Veeresh, Jul 8, 2004
    #7
  8. Veeresh

    Guest

    On Thu, 8 Jul 2004 11:17:00 -0700, "Veeresh" <>
    wrote:

    >Thats true. I am looking for options to disable the browser back button
    >too!!!
    >I am not finding the proper way through code to make sure after processing
    >the data in a page and if the use comes back, all posting may happen again.
    >I think the right way(professional way) is controlling through code.
    >I have the following code at the page_load event to expire the page once the
    >user is out of the current page
    >Response.Expires = 0
    >'Response.Cache.SetNoStore()
    >


    On method is using the SmartNavigation option. This make it so when a
    user hits the backbutton it will exit your app. There are some
    caveats so you will want to research this option and see if it works
    for you.

    -Adam
    , Jul 8, 2004
    #8
  9. Veeresh

    Veeresh Guest

    Interesting. I am already using smart navigation in my application. It is
    really a nice feauture. But very curious to know how to disable browser
    button using Smart Navigation.
    Veer


    <> wrote in message
    news:...
    > On Thu, 8 Jul 2004 11:17:00 -0700, "Veeresh" <>
    > wrote:
    >
    > >Thats true. I am looking for options to disable the browser back button
    > >too!!!
    > >I am not finding the proper way through code to make sure after

    processing
    > >the data in a page and if the use comes back, all posting may happen

    again.
    > >I think the right way(professional way) is controlling through code.
    > >I have the following code at the page_load event to expire the page once

    the
    > >user is out of the current page
    > >Response.Expires = 0
    > >'Response.Cache.SetNoStore()
    > >

    >
    > On method is using the SmartNavigation option. This make it so when a
    > user hits the backbutton it will exit your app. There are some
    > caveats so you will want to research this option and see if it works
    > for you.
    >
    > -Adam
    Veeresh, Jul 8, 2004
    #9
  10. Veeresh

    Veeresh Guest

    The following code worked for me.

    Response.Cache.SetExpires(DateTime.Now.AddSeconds(0)) '1

    Response.Cache.SetCacheability(HttpCacheability.NoCache) '2

    Response.Cache.SetValidUntilExpires(False) '3

    Response.Cache.VaryByParams("Category") = True '4

    Really don't know how it is working. Really don't know the significance of
    line 4. If I comment the line 4, the entire logic does not work.

    Veer

    "Veeresh" <> wrote in message
    news:...
    > Interesting. I am already using smart navigation in my application. It is
    > really a nice feauture. But very curious to know how to disable browser
    > button using Smart Navigation.
    > Veer
    >
    >
    > <> wrote in message
    > news:...
    > > On Thu, 8 Jul 2004 11:17:00 -0700, "Veeresh" <>
    > > wrote:
    > >
    > > >Thats true. I am looking for options to disable the browser back button
    > > >too!!!
    > > >I am not finding the proper way through code to make sure after

    > processing
    > > >the data in a page and if the use comes back, all posting may happen

    > again.
    > > >I think the right way(professional way) is controlling through code.
    > > >I have the following code at the page_load event to expire the page

    once
    > the
    > > >user is out of the current page
    > > >Response.Expires = 0
    > > >'Response.Cache.SetNoStore()
    > > >

    > >
    > > On method is using the SmartNavigation option. This make it so when a
    > > user hits the backbutton it will exit your app. There are some
    > > caveats so you will want to research this option and see if it works
    > > for you.
    > >
    > > -Adam

    >
    >
    Veeresh, Jul 8, 2004
    #10
  11. Veeresh

    Curt_C [MVP] Guest

    it doesn't disable the button, it works around it....
    Again, dont try to adjust the users settings....ever... This is bad
    programming practice, besides the fact that you really cant without being
    considered a security risk

    --
    Curt Christianson
    Owner/Lead Developer, DF-Software
    Site: http://www.Darkfalz.com
    Blog: http://blog.Darkfalz.com


    "Veeresh" <> wrote in message
    news:...
    > Interesting. I am already using smart navigation in my application. It is
    > really a nice feauture. But very curious to know how to disable browser
    > button using Smart Navigation.
    > Veer
    >
    >
    > <> wrote in message
    > news:...
    > > On Thu, 8 Jul 2004 11:17:00 -0700, "Veeresh" <>
    > > wrote:
    > >
    > > >Thats true. I am looking for options to disable the browser back button
    > > >too!!!
    > > >I am not finding the proper way through code to make sure after

    > processing
    > > >the data in a page and if the use comes back, all posting may happen

    > again.
    > > >I think the right way(professional way) is controlling through code.
    > > >I have the following code at the page_load event to expire the page

    once
    > the
    > > >user is out of the current page
    > > >Response.Expires = 0
    > > >'Response.Cache.SetNoStore()
    > > >

    > >
    > > On method is using the SmartNavigation option. This make it so when a
    > > user hits the backbutton it will exit your app. There are some
    > > caveats so you will want to research this option and see if it works
    > > for you.
    > >
    > > -Adam

    >
    >
    Curt_C [MVP], Jul 8, 2004
    #11
  12. Veeresh

    Veeresh Guest

    Thanks for suggestions. I will stop thinking on changing the user settings.
    Its a good suggestions for me becuase somehow I also convinced that the best
    way is to take care in the application coding instead of setting the
    browser.
    Thanks
    Veer

    "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    news:...
    > it doesn't disable the button, it works around it....
    > Again, dont try to adjust the users settings....ever... This is bad
    > programming practice, besides the fact that you really cant without being
    > considered a security risk
    >
    > --
    > Curt Christianson
    > Owner/Lead Developer, DF-Software
    > Site: http://www.Darkfalz.com
    > Blog: http://blog.Darkfalz.com
    >
    >
    > "Veeresh" <> wrote in message
    > news:...
    > > Interesting. I am already using smart navigation in my application. It

    is
    > > really a nice feauture. But very curious to know how to disable browser
    > > button using Smart Navigation.
    > > Veer
    > >
    > >
    > > <> wrote in message
    > > news:...
    > > > On Thu, 8 Jul 2004 11:17:00 -0700, "Veeresh" <>
    > > > wrote:
    > > >
    > > > >Thats true. I am looking for options to disable the browser back

    button
    > > > >too!!!
    > > > >I am not finding the proper way through code to make sure after

    > > processing
    > > > >the data in a page and if the use comes back, all posting may happen

    > > again.
    > > > >I think the right way(professional way) is controlling through code.
    > > > >I have the following code at the page_load event to expire the page

    > once
    > > the
    > > > >user is out of the current page
    > > > >Response.Expires = 0
    > > > >'Response.Cache.SetNoStore()
    > > > >
    > > >
    > > > On method is using the SmartNavigation option. This make it so when a
    > > > user hits the backbutton it will exit your app. There are some
    > > > caveats so you will want to research this option and see if it works
    > > > for you.
    > > >
    > > > -Adam

    > >
    > >

    >
    >
    Veeresh, Jul 8, 2004
    #12
  13. > Its a good suggestions for me becuase somehow I also convinced that the
    best
    > way is to take care in the application coding instead of setting the


    Exactly right, Veer.

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    Big things are made up
    of lots of little things.

    "Veeresh" <> wrote in message
    news:...
    > Thanks for suggestions. I will stop thinking on changing the user

    settings.
    > Its a good suggestions for me becuase somehow I also convinced that the

    best
    > way is to take care in the application coding instead of setting the
    > browser.
    > Thanks
    > Veer
    >
    > "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    > news:...
    > > it doesn't disable the button, it works around it....
    > > Again, dont try to adjust the users settings....ever... This is bad
    > > programming practice, besides the fact that you really cant without

    being
    > > considered a security risk
    > >
    > > --
    > > Curt Christianson
    > > Owner/Lead Developer, DF-Software
    > > Site: http://www.Darkfalz.com
    > > Blog: http://blog.Darkfalz.com
    > >
    > >
    > > "Veeresh" <> wrote in message
    > > news:...
    > > > Interesting. I am already using smart navigation in my application. It

    > is
    > > > really a nice feauture. But very curious to know how to disable

    browser
    > > > button using Smart Navigation.
    > > > Veer
    > > >
    > > >
    > > > <> wrote in message
    > > > news:...
    > > > > On Thu, 8 Jul 2004 11:17:00 -0700, "Veeresh" <>
    > > > > wrote:
    > > > >
    > > > > >Thats true. I am looking for options to disable the browser back

    > button
    > > > > >too!!!
    > > > > >I am not finding the proper way through code to make sure after
    > > > processing
    > > > > >the data in a page and if the use comes back, all posting may

    happen
    > > > again.
    > > > > >I think the right way(professional way) is controlling through

    code.
    > > > > >I have the following code at the page_load event to expire the page

    > > once
    > > > the
    > > > > >user is out of the current page
    > > > > >Response.Expires = 0
    > > > > >'Response.Cache.SetNoStore()
    > > > > >
    > > > >
    > > > > On method is using the SmartNavigation option. This make it so when

    a
    > > > > user hits the backbutton it will exit your app. There are some
    > > > > caveats so you will want to research this option and see if it works
    > > > > for you.
    > > > >
    > > > > -Adam
    > > >
    > > >

    > >
    > >

    >
    >
    Kevin Spencer, Jul 8, 2004
    #13
    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. Kevin Spencer

    Re: How to disable right click mouse??

    Kevin Spencer, Jul 24, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    554
    Kevin Spencer
    Jul 24, 2003
  2. Davisro
    Replies:
    2
    Views:
    1,292
    Jim Corey
    Apr 23, 2004
  3. =?Utf-8?B?am9qb2Jhcg==?=
    Replies:
    1
    Views:
    4,073
    wwwtar
    Oct 2, 2006
  4. Kid Kid
    Replies:
    6
    Views:
    462
  5. Daniish
    Replies:
    2
    Views:
    232
    Thomas 'PointedEars' Lahn
    Jun 13, 2008
Loading...

Share This Page