Disable right click on web page using javascript



This tutorial will go over how to DisableRight Mouse Click using javascript

<!-- turn off right click -->

<script language=javascript>
var message="";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
</script>

Note:- This only stops people from right clicking on your page and there is no real way to stop people from viewing your html, if someone is determined to see your code they will.

2 comments :

Write Data to file in .Net ( VB and C# )



This tutorial will go over how to write data to a text file in VB.Net and C#.Net

.Net uses StreamWriter Class To write data to file. StreamWriter is designed for character output in a particular encoding, whereas classes derived from Stream are designed for byte input and output.

VB .Net

Dim objWriter As New System.IO.StreamWriter("d:\abc.txt", True)  
objWriter.WriteLine("Some Text here")
objWriter.Close()

C# .Net

using (System.IO.StreamWriter objWriter = new System.IO.StreamWriter(@"abc.txt", true))
{
       objWriter.WriteLine("Some Text here");
}
objWriter.Close(); 
 

0 comments :

Read Data from text file in .Net ( VB and C#)



This tutorial will go over how to read data from a text file in VB.Net and C#.Net

.Net uses StreamReader Class To read data. StreamReader is designed for character input in a particular encoding, whereas the Stream class is designed for byte input and output. Use StreamReader for reading lines of information from a standard text file.

VB .Net

Dim line As String = ""
Dim objReader As New System.IO.StreamReader("d:\abc.txt", True) 
Do line = objReader.ReadLine()
Console.WriteLine(line)
Loop Until line Is Nothing
objReader.Close()

C# .Net
using (StreamReader objReader = new StreamReader("abc.txt")) 
{
    string line;
    // Read and display lines from the file
    while ((line = objReader.ReadLine()) != null) 
    {
         Console.WriteLine(line);
    }
}

0 comments :