Open EXE Using Javascript

Labels:

<html>
<head>
<script language="javascript">
function loadexe()
{
alert('invoke');
w = new ActiveXObject("WScript.Shell");
w.run('notepad.exe');
return true;
}
</script>
</head>
<body onload=loadexe()>
</body>
</html>

CONVERT IMAGE TO BYTE USING ASP.NET

Labels: ,

Namespaces :-

System.Drawing;

Coding :-

byte[] bytArray;
Bitmap bImg = new Bitmap(Server.MapPath(path));
ImageConverter imgCon = new ImageConverter();
bytArray = (byte[])imgCon.ConvertTo(bImg , typeof(byte[]));

Upload the File in ASP.NET

Labels:

In this example we browse a file from our pc and upload that file to some other loaction in our pc.

Default.aspx

\\Place a file type textbox and a button




<input type=file id=File1 name=File1 runat="server">
<input type="submit" id="Submit1" value="Upload" runat="server" name="Submit1">

Defalut.aspx.cs

if( ( File1.PostedFile != null ) && ( File1.PostedFile.ContentLength > 0 ) )
{
string fn = System.IO.Path.GetFileName(File1.PostedFile.FileName);
string SaveLocation = Server.MapPath("Data") + "\\" + fn;\\Create Data Folder within the Location u Specified
\\File will be Uploaded to the Specified Location
try
{
File1.PostedFile.SaveAs(SaveLocation);
Response.Write("The file has been uploaded.");
}
catch ( Exception ex )
{
Response.Write("Error: " + ex.Message);
}
}
else
{
Response.Write("Please select a file to upload.");
}