Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1)Regular Expression for checking the range of password like between 4 to 10 chars and
should be only alphabets….
^[a-zA-Z'.\s]{4,10}$
mail.To.Add(TextBox1.Text);
mail.Subject = TextBox3.Text;
mail.Body = TextBox4.Text;
smtp.Credentials = new
NetworkCredential("dinniesuper@gmail.com", "1234");
try
{
smtp.Send(mail);
}
catch (SmtpException ex)
{
Label5.Text = ex.ToString();
Label5.Visible = true;
}
}
c) CSS Tutorial
www.w3schools.com/css/
D) Code to check how many times our site has been hit, or to check
site traffic
1)
<%@ Application Language="C#" %><script runat="server">
void Application_Start(object sender, EventArgs e)
{
Application["userCount"] = 0;
Application["usersOnline"] = 0;
}
void Session_Start(object sender, EventArgs e)
{
Session.Timeout = 20;Application.Lock();
Application["userCount"]=1+(int)Application["userCount"];
Session["someValue"] = Session.SessionID;
Application["usersOnline"] = (int)Application["usersOnline"] + 1;
Application.UnLock();
}
void Session_End(object sender, EventArgs e)
{
Application.Lock();
Application["usersOnline"] = (int)Application["usersOnline"] - 1;
Application.UnLock();
}
2)
The level of this code requires only a minimal amount of knowledge of the
.NET environment, and of course your website should be hosted on a
windows server with the .NET environment.
This code can be copied and pasted in the footer area of any .aspx file in
your website. Generally, you would put it in the footer of the home page,
or at least that's a good place to start.
The first thing you'll want to do is create an empty text file, call it
counter.txt and save it to your root directory. The next step is even easier,
copy and paste the code below into your .aspx file and save it. Be sure to
import the system.IO class into your page something like this
StreamReader re = File.OpenText(Server.MapPath("counter.txt"));
re.Close();
myInt = myInt + 1;
tw.WriteLine(Convert.ToString(myInt));
tw.Close();
re = File.OpenText(Server.MapPath("counter.txt"));
input = null;
mycounter = "";
}
re.Close();
return mycounter;
b. Call the StreamReader class from the system.IO library and read your
text file
f. Add 1 to the variable holding the value from the text file
is the line that calls the method when someone visits your homepage for instance.
You can put all of the code at the bottom of the page, or if you are a little more
experienced with c# you could place it in a "code-behind" file or an "include" of class
methods to keep the code a bit more clean.
Application.DoEvents();
float data=zipOut.Length/(1024*1024);
if ( data<25.0)
{
if (xname != Zipfilename)
{
if (chkdownload(fi.FullName))
{
//---------------
string strinsert = "Insert into
dictationinfo(job_no,created_dt)values('" +
sptemp[0] + "','" +
File.GetCreationTime(fi.FullName) + "')";
comlocal = new
SqlCommand(strinsert, conlocal, contrans);
if (conlocal.State ==
ConnectionState.Closed)
conlocal.Open();
int res1 =
comlocal.ExecuteNonQuery();
//---------------
FileStream sReader =
File.Open(fi.FullName, FileMode.Open);
byte[] buff = new
byte[Convert.ToInt32(sReader.Length)];
sReader.Read(buff, 0,
(int)sReader.Length);
entry.DateTime = fi.LastWriteTime;
entry.Size = sReader.Length;
sReader.Close();
zipOut.PutNextEntry(entry);
zipOut.Write(buff, 0, buff.Length);
}
}
}
else
{
break;
}
}
zipOut.Finish();
zipOut.Close();
contrans.Commit();
}
catch (Exception ex)
{
errorstring(ex.Message.ToString() + " " +
ex.StackTrace.ToString());
if (zipOut != null)
{
zipOut.Finish();
zipOut.Close();
}
contrans.Rollback();
}
return FileNames;
Ipaddr[2] = mac;
}
return Ipaddr[2];
}
catch (Exception ex)
{
return "Error";
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString() + " " +
ex.StackTrace.ToString());
throw;
}
return result;
}
2) ^[a-z0-9_\+-]+(\.[a-z0-9_\+-]+)*@[a-z0-9-]+(\.[a-z0-9-]
+)*\.([a-z]{2,4})$
3) ^[a-z0-9,!#\$%&'\*\+/=\?\^_`\{\|}~-]+(\.[a-z0-
9,!#\$%&'\*\+/=\?\^_`\{\|}~-]+)*@[a-z0-9-]+(\.[a-z0-9-]
+)*\.([a-z]{2,})$
<SCRIPT LANGUAGE="JAVASCRIPT">
</SCRIPT>