Posts

Showing posts from April, 2011

Web Security Tip: How to prevent Denial of Service (DoS) attack?

What is a denial-of-service (DoS) attack?
In a denial-of-service (DoS) attack, an attacker attempts to prevent legitimate users from accessing information or services. By targeting your computer and its network connection, or the computers and network of the sites you are trying to use, an attacker may be able to prevent you from accessing email, websites, online accounts (banking, etc.), or other services that rely on the affected computer.

How it works?

Let's see how it make the problem,"n" is a typical connection, the user sends a message asking the server to authenticate it. The server returns the authentication approval to the user. The user acknowledges this approval and then is allowed onto the server.

In a denial of service attack, the user sends several authentication requests to the server, filling it up. All requests have false return addresses, so the server can,t find the user when it tries to send the authentication approval. The server waits, sometimes mor…

How to save image from direct local URL to File

In my recent project its an requirement to save images from URL to hard disk or any media. After binged I have got several solutions. Now sharing you the right solution which is work for me.

Code(C#):

protected void Page_Load(object sender, EventArgs e)
{
string url = "http://img510.imageshack.us/img510/5523/aspnet4jh.jpg";
string DestinationPath ="C:/temp";
string filename = url.Substring(url.LastIndexOf('/')+1);
byte[] bytes=GetBytesFromUrl(url);
WriteBytesToFile(DestinationPath +"/"+filename, bytes);
}

static public byte[] GetBytesFromUrl(string url)
{
byte[] b;
HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(url);
WebResponse myResp = myReq.GetResponse();

Stream stream = myResp.GetResponseStream();
//int i;
using (BinaryReader br = new BinaryReader(stream))
{
//i = (int)(stream.Length);
b = br.ReadBytes(500…

Achieve MVP award from Microsoft

Image
Yesterday I got an email from Microsoft Community ..

"
Dear Ahsan

Congratulations on getting awarded as an MVP for contributing to the technical communities!

I am Abhishek Kant, your MVP Lead and would facilitate your interaction with Microsoft including administration of award benefits and providing latest information.............

"

Thanks to Microsoft Community to give this reward to the community contributor. It is really inspired the community member to keep up their activities.

I feel lucky to join in MVP community for the first time, hope that this is a great opportunity for me to rich my experience by sharing knowledge with other MVP.

Thanks to all for their co operation.