Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Disable Functions


Message #1 by "Hiro Shiratori" <hiro-shiratori@m...> on Thu, 27 Dec 2001 13:15:23 -0800
Hello:



I have placed the following code as a file into my asp, which allows to 

suspend certain actions.



^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

var isnn,isie

if(navigator.appName=3D=3D'Microsoft Internet

Explorer') //check the browser

{  isie=3Dtrue }



if(navigator.appName=3D=3D'Netscape')

{  isnn=3Dtrue }



function right(e) //to trap right click button

{

 if (isnn && (e.which =3D=3D 3 || e.which =3D=3D 2 ))

  return false;

 else if (isie && (event.button =3D=3D 2 ||

event.button =3D=3D 3))

 {

  alert("Sorry, you do not have permission

to right click on this page.");

  return false;

 }

  return true;

}



function key(k)  

{

 if(isie) {

  if(event.keyCode=3D=3D17 || event.keyCode=3D=3D18

|| event.keyCode=3D=3D93) {

   alert("Sorry, you do not have

permission to press this key.")

   return false;

   }

 }



 if(isnn){

  alert("Sorry, you do not have permission

to press this key.")

  return false; }  

}



if (document.layers) window.captureEvents

(Event.KEYPRESS); 

if (document.layers) window.captureEvents(Event.MOUSEDOWN);

if (document.layers) window.captureEvents(Event.MOUSEUP);

document.onkeydown=3Dkey; 

document.onmousedown=3Dright;

document.onmouseup=3Dright;

window.document.layers=3Dright;

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

My question is:

Is it possible to disable the menu bar function (View -

Source on the internet explorer)?

If so, do I need to use the similar key code and are there any key codes 

for this?



Any help will be greatly appreciated.



Best regards,

Hiro





Message #2 by "Kim Iwan Hansen" <kimiwan@k...> on Fri, 28 Dec 2001 21:47:44 +0100
you can't do that, and thank god for that.



you can't keep anyone from stealing your code by taking away the right-click

option, only thing it does is make your homepage less userfriendly.  try and

go to a random webpage and right-click on it - understand that you're taking

these options that you see away from the user when you're disabling

right-clicking.  taking away the right-click option is a directly "user

hostile" act.  it's a no-win situation.



i think a better way to secure your code would be to use the script encoder

from microsoft - though, of course, that too can be hacked.  judging from

your current level of security, that's probably closer to what you

want/need.



think about it :)



-Kim













> -----Original Message-----

> From: Hiro Shiratori [mailto:hiro-shiratori@m...]

> Sent: 27. december 2001 22:15

> To: ASP Databases

> Subject: [asp_databases] Disable Functions

>

>

> Hello:

>

> I have placed the following code as a file into my asp, which

> allows to suspend certain actions.

>

> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

> var isnn,isie

> if(navigator.appName=='Microsoft Internet

> Explorer') //check the browser

> {  isie=true }

>

> if(navigator.appName=='Netscape')

> {  isnn=true }

>

> function right(e) //to trap right click button

> {

>  if (isnn && (e.which == 3 || e.which == 2 ))

>   return false;

>  else if (isie && (event.button == 2 ||

> event.button == 3))

>  {

>   alert("Sorry, you do not have permission

> to right click on this page.");

>   return false;

>  }

>   return true;

> }

>

> function key(k)

> {

>  if(isie) {

>   if(event.keyCode==17 || event.keyCode==18

> || event.keyCode==93) {

>    alert("Sorry, you do not have

> permission to press this key.")

>    return false;

>    }

>  }

>

>  if(isnn){

>   alert("Sorry, you do not have permission

> to press this key.")

>   return false; }

> }

>

> if (document.layers) window.captureEvents

> (Event.KEYPRESS);

> if (document.layers) window.captureEvents(Event.MOUSEDOWN);

> if (document.layers) window.captureEvents(Event.MOUSEUP);

> document.onkeydown=key;

> document.onmousedown=right;

> document.onmouseup=right;

> window.document.layers=right;

> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

> My question is:

> Is it possible to disable the menu bar function (View -

> Source on the internet explorer)?

> If so, do I need to use the similar key code and are there any

> key codes for this?

>

> Any help will be greatly appreciated.

>

> Best regards,

> Hiro

>

>

>




> $subst('Email.Unsub').

>



Message #3 by Kyle Burns <kburns@c...> on Fri, 28 Dec 2001 16:38:09 -0500
How are you going to prevent a persistant user from simply using notepad to

open your page from his Temporary Internet Files?  It's impossible to

prevent a user from viewing HTML source.  If you have something that is that

important to hide, you may want to consider wrapping it in an applet.







=================================

Kyle M. Burns, MCSD, MCT

ECommerce Technology Manager

Centra Credit Union

kburns@c...



 



>> -----Original Message-----

>> From: Kim Iwan Hansen [mailto:kimiwan@k...]

>> Sent: Friday, December 28, 2001 3:48 PM

>> To: ASP Databases

>> Subject: [asp_databases] RE: Disable Functions

>> 

>> 

>> you can't do that, and thank god for that.

>> 

>> you can't keep anyone from stealing your code by taking away 

>> the right-click

>> option, only thing it does is make your homepage less 

>> userfriendly.  try and

>> go to a random webpage and right-click on it - understand 

>> that you're taking

>> these options that you see away from the user when you're disabling

>> right-clicking.  taking away the right-click option is a 

>> directly "user

>> hostile" act.  it's a no-win situation.

>> 

>> i think a better way to secure your code would be to use the 

>> script encoder

>> from microsoft - though, of course, that too can be hacked.  

>> judging from

>> your current level of security, that's probably closer to what you

>> want/need.

>> 

>> think about it :)

>> 

>> -Kim

>> 

>> 

>> 

>> 

>> 

>> 

>> > -----Original Message-----

>> > From: Hiro Shiratori [mailto:hiro-shiratori@m...]

>> > Sent: 27. december 2001 22:15

>> > To: ASP Databases

>> > Subject: [asp_databases] Disable Functions

>> >

>> >

>> > Hello:

>> >

>> > I have placed the following code as a file into my asp, which

>> > allows to suspend certain actions.

>> >

>> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

>> > var isnn,isie

>> > if(navigator.appName=='Microsoft Internet

>> > Explorer') //check the browser

>> > {  isie=true }

>> >

>> > if(navigator.appName=='Netscape')

>> > {  isnn=true }

>> >

>> > function right(e) //to trap right click button

>> > {

>> >  if (isnn && (e.which == 3 || e.which == 2 ))

>> >   return false;

>> >  else if (isie && (event.button == 2 ||

>> > event.button == 3))

>> >  {

>> >   alert("Sorry, you do not have permission

>> > to right click on this page.");

>> >   return false;

>> >  }

>> >   return true;

>> > }

>> >

>> > function key(k)

>> > {

>> >  if(isie) {

>> >   if(event.keyCode==17 || event.keyCode==18

>> > || event.keyCode==93) {

>> >    alert("Sorry, you do not have

>> > permission to press this key.")

>> >    return false;

>> >    }

>> >  }

>> >

>> >  if(isnn){

>> >   alert("Sorry, you do not have permission

>> > to press this key.")

>> >   return false; }

>> > }

>> >

>> > if (document.layers) window.captureEvents

>> > (Event.KEYPRESS);

>> > if (document.layers) window.captureEvents(Event.MOUSEDOWN);

>> > if (document.layers) window.captureEvents(Event.MOUSEUP);

>> > document.onkeydown=key;

>> > document.onmousedown=right;

>> > document.onmouseup=right;

>> > window.document.layers=right;

>> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

>> > My question is:

>> > Is it possible to disable the menu bar function (View -

>> > Source on the internet explorer)?

>> > If so, do I need to use the similar key code and are there any

>> > key codes for this?

>> >

>> > Any help will be greatly appreciated.

>> >

>> > Best regards,

>> > Hiro

>> >

>> >

>> >




>> > $subst('Email.Unsub').

>> >

>> 

>> 




>> $subst('Email.Unsub').

>> 


  Return to Index