ksdh
hello
tESsting sdlaflsdflsdfhl lsdjfjsdf
Tuesday, February 03, 2009 | 0 Comments
<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>
Tuesday, November 27, 2007 | 0 Comments
Namespaces :-
System.Drawing;
Coding :-
byte[] bytArray;
Bitmap bImg = new Bitmap(Server.MapPath(path));
ImageConverter imgCon = new ImageConverter();
bytArray = (byte[])imgCon.ConvertTo(bImg , typeof(byte[]));
Saturday, November 03, 2007 | 0 Comments
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.");
}
Sunday, October 07, 2007 | 0 Comments
We have to create a excel as a database.
Step 1 : Open Excel sheet and enter data's
Step 2 : Select the data's which u want.
Step 3 : Click Insert tab->Name->Define
Step 4 : Give the name for the selected data's
pgeExcel.cs
Now we display the excel database in a gridview which we created.
OleDbDataAdapter da;
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;
data source=f:/Book1.xls;Extended Properties=Excel 8.0;");
con.open();
da = new OleDbDataAdapter("select * from emp", con);//emp is the name given in excel sheet
DataSet ds=new DataSet();
da.Fill(ds,"emp");
GridView1.DataSource=ds;
GridView1.DataBind();
Thursday, September 27, 2007 | 0 Comments
// Data Provider for OLE DB
using System.Data.OleDb
OleDbConnection oracleConn = new OleDbConnection("Provider= \"OraOLEDB.Oracle.1\";User ID=scott;Password=tiger;Data Source=yourSource; Extended Properties="";Persist Security Info=False";);
//Data Provider for ODBC
using System.Data.Odbc
OdbcConnection oracleConn = new OdbcConnection("DSN=odbcName ;UID=scott;PWD=tiger;DRIVER={Microsoft ODBC for Oracle};
SERVER=oracleServerNameOr IPAddress;";);
//Data Provider for Oracle Client
using System.Data.OracleClient
OracleConnection oracleConn = new OracleConnection("user id=scott;
data source=oracleSN;password=tiger";);
Tuesday, September 25, 2007 | 0 Comments
Wednesday, September 19, 2007 | 0 Comments
<script language=javascript>
function NumberOnly()
{
var keyCode = event.keyCode;
if(keyCode > 47 && keyCode < 58)
{
return true;
}
else
{
return false;
}
}
</script>
<asp:TextBox ID="txt" runat="server" onkeypress="return NumberOnly()"></asp:TextBox>
Place the Script in the keyPress Event of the textbox to see the result.
Monday, September 17, 2007 | 0 Comments
Syntax :
ScriptManager.RegisterStartupScript(Control control,type type,string Key,string Script,bool addScriptTags)
Example:
string s = "alert('Hello')";
ScriptManager.RegisterStartupScript(this, this.GetType(), "Hello", s, true);
If you give the script tag in the string s then give addScriptTags to false.
ScriptManager is a class inside System.Web.UI
As a result a alert box with 'hello' pops up, where you place this line.
Wednesday, September 12, 2007 | 0 Comments
Authorization is to determine whether an identity should be granted the requested type of access to a given resource.
users: Assign a list of users to be granted or denied access
Roles: Assign a list of roles to be granted or denied access
<allow users="Don , Jim" roles="Admins" /> //Allow only two user Don,Jim
<deny users="*" /> //Restrict all other user
</authorization>
//Allow All the user to access
<allow users="*" />
</authorization>
* Refers to all identities
? Refers to the anonymous identity
Tuesday, September 11, 2007 | 0 Comments
//search all floppy,cd and hard disk drives available in our PC
//its varies from system to system
for(char Ch='A';Ch<='Z';Ch++) { string Dir = Ch + @":\"; if (Directory.Exists(Dir)) {
disksListBox.Items.Add( Ch+ @":" ); //Add into ListBox
}
}
Tuesday, September 04, 2007 | 0 Comments
//copy the data using Clipboard
Clipboard.SetDataObject(textBox1.SelectedText,true);
//paste the data using Clipboard
IDataObject iData = Clipboard.GetDataObject();
//Determine whether the data is in a format you can use.
if(iData.GetDataPresent(DataFormats.Text))
{
textBox1.SelectedText =(String)iData.GetData(DataFormats.Text); //display it in a text box.
}
Tuesday, September 04, 2007 | 0 Comments
//Declare the Header File
using System.Security.Principal;
string a;
a=System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
//Above Statement,opens us up to more than just the current user.
MessageBox.Show(a.ToString());
Monday, September 03, 2007 | 0 Comments
System.Diagnostics.Process.Start("calc");
System.Diagnostics.Process.Start("f:\\start.exe");
Sunday, September 02, 2007 | 0 Comments
using(StreamWriter sr=new StreamWriter("F:\\out.txt"))
{
sw.write("Have a nice day");
Response.write("saved");
}
Sunday, September 02, 2007 | 0 Comments
using(StreamReader sr=new StreamReader("h:\\appl.txt"))
{
while(sr.ReadLine()!=null)
{
string s;
s=sr.ReadLine();
ListBox1.Items.Add(s);
}
}
Sunday, September 02, 2007 | 0 Comments