Build social applications on Facebook Platform
The web is social. Developers just like you have built applications on Facebook Platform that millions of people use everyday. Join the developer community and help make the web even more social.
Facebook Developers
Facebook developers ASP.Net
Facebook developers ASP.Net
Facebook Developer Toolkit download
http://www.codeplex.com/FacebookToolkit
Getting Started with the Facebook Developer Toolkit
Getting Started with the Facebook Developer Toolkit
Anatomy of a Facebook application
Anatomy of a Facebook application
Facebook is a social networking website launched on February 4, 2004.[1] The free-access website is privately owned and operated by Facebook, Inc. Users can join networks organized by city, workplace, school, and region to connect and interact with other people. People can also add friends and send them messages, and update their personal profile to notify friends about themselves. The website's name refers to the paper facebooks depicting members of a campus community that some US colleges and preparatory schools give to incoming students, faculty, and staff as a way to get to know other people on campus.
Wikipedia Facebook
Inside Facebook - Latest news and Facebook applications. Tracking Facebook and the Facebook Platform for Developers and Marketers.
Inside Facebook
AppRate is a community-driven site that brings sense (and a bit of wit) to Facebook Applications. With daily reviews and ratings, we help users filter out the ‘good’ applications from the bad and ugly. Anyone and everyone is welcome to vote, and we encourage users to submit their own apps for review.
AppRate
Face Reviews - Social News, Reviews and Trends. Mission is to help companies extend their brand across all social media networks. We report & publish observations, reviews and trends related to Social Media.
Face Reviews
Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts
Wednesday, November 12, 2008
Tuesday, November 11, 2008
Master (GridView) Detail (FormView) refresh after update
Master Detail automatic GridView/FormView refresh after an update.
The secret to having a master (GridView) trigger a detail (FormView) and see it refresh after an update.
Just add the DataBind in Page_PreRenderComplete handler.
protected void Page_PreRenderComplete(object sender, EventArgs e)
{
GridView1.DataBind();
FormView1.DataBind();
}
Additional information:
Master-Detail with the GridView, DetailsView and ModalPopup Controls
GridView control to show master-child or master-slave data, written in c#, asp.net, and javascript.
Subject: Display data using gridview, by generating hidden div with child data. Javascript used to show and hide (collapse and expand) grid.
More...GridView control to show master-child or master-slave data, written in c#, asp.net, and javascript.
The secret to having a master (GridView) trigger a detail (FormView) and see it refresh after an update.
Just add the DataBind in Page_PreRenderComplete handler.
protected void Page_PreRenderComplete(object sender, EventArgs e)
{
GridView1.DataBind();
FormView1.DataBind();
}
Additional information:
Master-Detail with the GridView, DetailsView and ModalPopup Controls
GridView control to show master-child or master-slave data, written in c#, asp.net, and javascript.
Subject: Display data using gridview, by generating hidden div with child data. Javascript used to show and hide (collapse and expand) grid.
More...GridView control to show master-child or master-slave data, written in c#, asp.net, and javascript.
Labels:
ASP.Net,
C#,
master slave
Thursday, October 30, 2008
DotNet OpenId
This C# OpenID library adds OpenID 2.0 Provider and Relying Party support to your web site both programmatically and through convenient drop-in ASP.NET controls.
Go to article:
http://code.google.com/p/dotnetopenid/
Your Gmail Account is Now An OpenID
by Erick Schonfeld
You may not know it, but you probably have an OpenID. If you have a Yahoo account, you have an OpenID. If you have a Windows Live account, you will soon have an OpenID. And today, if you have a Google e-mail account, you can also start using your Gmail address as an OpenID.
Your Gmail Account is Now An OpenID
Go to article:
http://code.google.com/p/dotnetopenid/
Your Gmail Account is Now An OpenID
by Erick Schonfeld
You may not know it, but you probably have an OpenID. If you have a Yahoo account, you have an OpenID. If you have a Windows Live account, you will soon have an OpenID. And today, if you have a Google e-mail account, you can also start using your Gmail address as an OpenID.
Your Gmail Account is Now An OpenID
Tuesday, September 9, 2008
RSS Reader using ASP.NET 2.0 and C# 2005
ASP.Net Tutorials
RSS Feed is very popular in Internet. This tutorial will show you how to create a RSS Reader using ASP.NET 2.0 and C#.
In this sample, we created a simple function to process the RSS feed from a sample URL. This function define a string of rssURL as its parameter. This string contains the RSS's URL. It will use the value of rssURL to create a WebRequest.
WebRequest is the abstract base class for the .NET Framework's request/response model for accessing data from the Internet. An application that uses the request/response model can request data from the Internet in a protocol-agnostic manner, in which the application works with instances of the WebRequest class while protocol-specific descendant classes carry out the details of the request.
Requests are sent from an application to a particular URI, such as a Web page on a server. The URI determines the proper descendant class to create from a list of WebRequest descendants registered for the application. WebRequest descendants are typically registered to handle a specific protocol, such as HTTP or FTP, but can be registered to handle a request to a specific server or path on a server.
The response to this request will be put into WebResponse object. The WebResponse class is the abstract base class from which protocol-specific response classes are derived. Applications can participate in request and response transactions in a protocol-agnostic manner using instances of the WebResponse class while protocol-specific classes derived from WebResponse carry out the details of the request. Client applications do not create WebResponse objects directly; they are created by calling the GetResponse method on a WebRequest instance.
After then, the WebResponse object will be used to create a stream to get the XML data. Stream is the abstract base class of all streams. A stream is an abstraction of a sequence of bytes, such as a file, an input/output device, an inter-process communication pipe, or a TCP/IP socket. The Stream class and its derived classes provide a generic view of these different types of input and output, isolating the programmer from the specific details of the operating system and the underlying devices. The we used a XmlDocument to store the stream data. XmlDocument manipulating the data of XML, finally read the RSS contents from Feed.
More...
http://www.aspnettutorials.com/tutorials/xml/rss-aspnet2-csharp.aspx
RSS Feed is very popular in Internet. This tutorial will show you how to create a RSS Reader using ASP.NET 2.0 and C#.
In this sample, we created a simple function to process the RSS feed from a sample URL. This function define a string of rssURL as its parameter. This string contains the RSS's URL. It will use the value of rssURL to create a WebRequest.
WebRequest is the abstract base class for the .NET Framework's request/response model for accessing data from the Internet. An application that uses the request/response model can request data from the Internet in a protocol-agnostic manner, in which the application works with instances of the WebRequest class while protocol-specific descendant classes carry out the details of the request.
Requests are sent from an application to a particular URI, such as a Web page on a server. The URI determines the proper descendant class to create from a list of WebRequest descendants registered for the application. WebRequest descendants are typically registered to handle a specific protocol, such as HTTP or FTP, but can be registered to handle a request to a specific server or path on a server.
The response to this request will be put into WebResponse object. The WebResponse class is the abstract base class from which protocol-specific response classes are derived. Applications can participate in request and response transactions in a protocol-agnostic manner using instances of the WebResponse class while protocol-specific classes derived from WebResponse carry out the details of the request. Client applications do not create WebResponse objects directly; they are created by calling the GetResponse method on a WebRequest instance.
After then, the WebResponse object will be used to create a stream to get the XML data. Stream is the abstract base class of all streams. A stream is an abstraction of a sequence of bytes, such as a file, an input/output device, an inter-process communication pipe, or a TCP/IP socket. The Stream class and its derived classes provide a generic view of these different types of input and output, isolating the programmer from the specific details of the operating system and the underlying devices. The we used a XmlDocument to store the stream data. XmlDocument manipulating the data of XML, finally read the RSS contents from Feed.
More...
http://www.aspnettutorials.com/tutorials/xml/rss-aspnet2-csharp.aspx
ASP.NET AJAX RSS Reader
By steve.csharp
An ASP.NET AJAX RSS reader.
Introduction
So the other day, I was adding a “news page” to one of my projects, and thought it was a great chance to play with consuming some other RSS feeds that had related information to what I was working on. So, I started looking round, and found the RSS Toolkit that had an RSS Data Source control that is perfect for consuming RSS feeds – the toolkit actually does much more, you should have a read on Dmitry’s blog (he wrote the toolkit and is on the ASP.NET team) and download the toolkit here.
I have also used the ASP.NET AJAX Toolkit (which if you are unaware is a collection of controls for use with ASP.NET AJAX, it's an open source project with contributors from both MS and the community). The control I use is the Collapsible Panel control, so you can see a list of the blogs and click each to reveal the text.
Background
You will need to have the ASP.NET AJAX RC1 extensions installed, which you can get from here.
Using the code
Simple page layout using CSS, the right panel contains a DataList control bound to the RssDataSource to display the blog items, the DataList control is wrapped in an asp:UpdatePanel. The item template in the DataList has a collapsiblepanelextender from the AjaxControlToolkit to display the description of the blog item.
Changing the selection of blog to view files, the asp:UpdateProgress panel is set to display, and the blog items are loaded and displayed. You can see on the blog list that I have simply shaded the background of the element to show the active blog.
More...
http://www.codeproject.com/KB/ajax/AspNetAJAXRssReader.aspx
An ASP.NET AJAX RSS reader.
Introduction
So the other day, I was adding a “news page” to one of my projects, and thought it was a great chance to play with consuming some other RSS feeds that had related information to what I was working on. So, I started looking round, and found the RSS Toolkit that had an RSS Data Source control that is perfect for consuming RSS feeds – the toolkit actually does much more, you should have a read on Dmitry’s blog (he wrote the toolkit and is on the ASP.NET team) and download the toolkit here.
I have also used the ASP.NET AJAX Toolkit (which if you are unaware is a collection of controls for use with ASP.NET AJAX, it's an open source project with contributors from both MS and the community). The control I use is the Collapsible Panel control, so you can see a list of the blogs and click each to reveal the text.
Background
You will need to have the ASP.NET AJAX RC1 extensions installed, which you can get from here.
Using the code
Simple page layout using CSS, the right panel contains a DataList control bound to the RssDataSource to display the blog items, the DataList control is wrapped in an asp:UpdatePanel. The item template in the DataList has a collapsiblepanelextender from the AjaxControlToolkit to display the description of the blog item.
Changing the selection of blog to view files, the asp:UpdateProgress panel is set to display, and the blog items are loaded and displayed. You can see on the blog list that I have simply shaded the background of the
More...
http://www.codeproject.com/KB/ajax/AspNetAJAXRssReader.aspx
Consuming Membership and Profile Services via ASP.NET AJAX
By Bipin Joshi
ASP.NET 2.0 introduced various application services—such as Membership, Roles, and Profiles—that eliminate a lot of coding that was required to provide the same functionality. However, these services are part of ASP.NET's server-side framework, which could pose a challenge when you use ASP.NET AJAX to consume the services from client-side JavaScript code. Fortunately, ASP.NET AJAX provides an out-of-the-box solution to this problem. This article explains how to use this solution in C# with Visual Studio.
Sample Scenario
Suppose you are developing a new web site and want to implement forms authentication. The web site will have a user registration page, a login page, and one or more pages that you must secure. The user registration and login pages use ASP.NET AJAX for an enhanced user experience. Also, the site must capture details such as birth date and address at the time of registration. This information is to be stored in the Profile of the user.
To develop a web site that fulfills all the above requirements, begin by creating a new ASP.NET AJAX-enabled web site with C# (see Figure 1).
More...
http://www.developer.com/net/asp/article.php/10917_3661801_1
ASP.NET 2.0 introduced various application services—such as Membership, Roles, and Profiles—that eliminate a lot of coding that was required to provide the same functionality. However, these services are part of ASP.NET's server-side framework, which could pose a challenge when you use ASP.NET AJAX to consume the services from client-side JavaScript code. Fortunately, ASP.NET AJAX provides an out-of-the-box solution to this problem. This article explains how to use this solution in C# with Visual Studio.
Sample Scenario
Suppose you are developing a new web site and want to implement forms authentication. The web site will have a user registration page, a login page, and one or more pages that you must secure. The user registration and login pages use ASP.NET AJAX for an enhanced user experience. Also, the site must capture details such as birth date and address at the time of registration. This information is to be stored in the Profile of the user.
To develop a web site that fulfills all the above requirements, begin by creating a new ASP.NET AJAX-enabled web site with C# (see Figure 1).
More...
http://www.developer.com/net/asp/article.php/10917_3661801_1
Monday, September 8, 2008
Sending Email with System.Net.Mail
Scott Gu
NET 2.0 includes much richer Email API support within the System.Net.Mail code namespace. I've seen a few questions from folks wondering about how to get started with it. Here is a simple snippet of how to send an email message from “sender@foo.bar.com” to multiple email recipients (note that the To a CC properties are collections and so can handle multiple address targets):
MailMessage message = new MailMessage();
message.From = new MailAddress("sender@foo.bar.com");
message.To.Add(new MailAddress("recipient1@foo.bar.com"));
message.To.Add(new MailAddress("recipient2@foo.bar.com"));
message.To.Add(new MailAddress("recipient3@foo.bar.com"));
message.CC.Add(new MailAddress("carboncopy@foo.bar.com"));
message.Subject = "This is my subject";
message.Body = "This is the content";
SmtpClient client = new SmtpClient();
client.Send(message);
System.Net.Mail reads SMTP configuration data out of the standard .NET configuration system (so for ASP.NET applications you’d configure this in your application’s web.config file). Here is an example of how to configure it:
More...
http://weblogs.asp.net/scottgu/archive/2005/12/10/432854.aspx
NET 2.0 includes much richer Email API support within the System.Net.Mail code namespace. I've seen a few questions from folks wondering about how to get started with it. Here is a simple snippet of how to send an email message from “sender@foo.bar.com” to multiple email recipients (note that the To a CC properties are collections and so can handle multiple address targets):
MailMessage message = new MailMessage();
message.From = new MailAddress("sender@foo.bar.com");
message.To.Add(new MailAddress("recipient1@foo.bar.com"));
message.To.Add(new MailAddress("recipient2@foo.bar.com"));
message.To.Add(new MailAddress("recipient3@foo.bar.com"));
message.CC.Add(new MailAddress("carboncopy@foo.bar.com"));
message.Subject = "This is my subject";
message.Body = "This is the content";
SmtpClient client = new SmtpClient();
client.Send(message);
System.Net.Mail reads SMTP configuration data out of the standard .NET configuration system (so for ASP.NET applications you’d configure this in your application’s web.config file). Here is an example of how to configure it:
More...
http://weblogs.asp.net/scottgu/archive/2005/12/10/432854.aspx
Send mail through .aspx C#
By benjarras
How to send an email in Dot Net
All the Contact Us forms needs an e-mail system
In this article you will learn how to send emails from you .aspx site, using plain format, html format also add attachments by two ways, the quick (easy way) and the profesional ( i like this way ) The first step is be sure that the SMTP Server is locally installed at SMTP Service of the IIS
Easy Way
This is an easy and quick way to do that, we will call this form ContactMe.aspx First, we have to import the System.Web.Mail Then in the code behind add the namespace
using System.Web.Mail;
Now build your message
string To = "cgodinez@technomex.net";
string From = "mymail@mail.com";
string Subject = "The Famous";
string Body = "Hello World";
SmtpMail.Send(From,To,Subject,Body);
What is the SmtpMail?
this class has a method called Send that allows the user to send an email, in this way we set four parameters:
SmtpMail.Send("mymail@mail.com","cgodinez@technomex.net","The Famous","Hello World");
As you can see this is the easy and quick way to do that. Now you will lear how to do the professional way (interesting). Here you will send an email including an attachment and CC, we can use the same parameters above
Professional Way (I like this Way)
We have to create an object (MailMessage) called myMail
More...
http://www.codeproject.com/KB/aspnet/mailing.aspx
How to send an email in Dot Net
All the Contact Us forms needs an e-mail system
In this article you will learn how to send emails from you .aspx site, using plain format, html format also add attachments by two ways, the quick (easy way) and the profesional ( i like this way ) The first step is be sure that the SMTP Server is locally installed at SMTP Service of the IIS
Easy Way
This is an easy and quick way to do that, we will call this form ContactMe.aspx First, we have to import the System.Web.Mail Then in the code behind add the namespace
using System.Web.Mail;
Now build your message
string To = "cgodinez@technomex.net";
string From = "mymail@mail.com";
string Subject = "The Famous";
string Body = "Hello World";
SmtpMail.Send(From,To,Subject,Body);
What is the SmtpMail?
this class has a method called Send that allows the user to send an email, in this way we set four parameters:
SmtpMail.Send("mymail@mail.com","cgodinez@technomex.net","The Famous","Hello World");
As you can see this is the easy and quick way to do that. Now you will lear how to do the professional way (interesting). Here you will send an email including an attachment and CC, we can use the same parameters above
Professional Way (I like this Way)
We have to create an object (MailMessage) called myMail
More...
http://www.codeproject.com/KB/aspnet/mailing.aspx
C# WEPkey generator
By Mark van den Broek
A Wepkey generator for protecting your wireless LAN
Introduction
Whatever bad you may have heard about WEP (Wired Equivalent Privacy) encryption for wireless networks, not using it is asking for trouble. Usually, it is quick and easy to set up, and at the very least, it doesn't cost you anything!
However, generating random WEP keys to use can be a pain - it's difficult to think up new ones, and if you want good security on your wireless network, you need to change them regularly. I found a JavaScript based WepKey Generator at Warewolf Labs and got so inspired, so I had to make a WepKey generator in C#. The entire code was written in JavaScript, and have kindly made the code available free for distribution (many thanks to them for a great job!) Several method calls in JavaScript don't exist in the .NET framework, so I had to create an equivalent for them. The second thing that I had to do was to re-package the entire regenerated C# code into an object oriented jacket. This can be a kind of handy when you want to inherit the WepKey class into your own projects. Using this application, you can generate good strong WEP keys for your wireless LAN! A good primer on WEP key setup and terms is located here.
First of all, this application can be divided into two sections:
One, create a WepKey based on a custom Pass phrase.
Two, generate a pseudo random WepKey by selecting the corresponding length required by your hardware.
First, I had to create a resource for my application to match the entered pass phrases. The first array is a char array that can hold up to 95 most used (ASCII) characters. The second is a string array that holds the same length as the ASCII array.
Collapse
///
/// Two public static array's for serving as a resource
/// witch will be used to match the input (string) value.
/// Both array's share the same index.
///
///
/// These are the 95 most possible characters from witch
/// to choose for generating the WEP key.
///
public static char [] asciiArray = new char[95] {
' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')',
'*', '+', ',', '-', '.', '/','0', '1', '2', '3',
'4', '5', '6', '7', '8', '9', ':', ';', '<', '=',
'>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q',
'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[',
'\\', ']', '^', '_', '\'', 'a', 'b', 'c', 'd', 'e',
'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y',
'z', '{', '|', '}', '~'
};
///
/// 95 HEX value's that uses the ASCII index from above.
///
public static string [] hexArray = new string [95] {
"20","21","22","23","24","25","26","27","28","29",
"2A","2B","2C","2D","2E","2F","30","31","32","33",
"34","35","36","37","38","39","3A","3B","3C","3D",
"3E","3F","40","41","42","43","44","45","46","47",
"48","49","4A","4B","4C","4D","4E","4F","50","51",
"52","53","54","55","56","57","58","59","5A","5B",
"5C","5D","5E","5F","60","61","62","63","64","65",
"66","67","68","69","6A","6B","6C","6D","6E","6F",
"70","71","72","73","74","75","76","77","78","79",
"7A","7B","7C","7D","7E"
};
The first option in this application is to create a Custom WepKey by entering a pass phrase. The custom pass phrase string is separated into characters which have been individual matched in the (ASCII) resource array and returns an integer index number. This number will be re consumed by the second method StringToHex to collect the HEX equivalent, and will be merged into one string that finally will be returned to the caller.
///
/// This method actually iterates trough the length
/// of the passphrase to match each character in
/// the Resources.asciiArray using the method LocateAciiIndex.
/// Finally the actually result is matched in the Resources.hexArray
/// and returns the result in variable string Result.
/// Finally string Result is returned to the caller.
///
public string StringToHex() {
int i = (int)InitialValue.DefaultIntegerValue; int j = i;
string Result = string.Empty;
try {
for (i = (int)InitialValue.DefaultIntegerStartValue;
i < WepString.Length; i++) {
j = this.LocateAsciiIndex(WepString[i]);
Result += Resources.hexArray[j];
}
}
catch (System.IndexOutOfRangeException ex) {
Messaging.WepKeyMessage(ex.Message,
Messaging.MessageIcon.Critical());
}
return Result;
}
The second option in this application, probable the strongest, is to create a pseudo random WepKey. It uses pretty much the same methods; the only thing is that GenerateStrongKey now gives the pass phrase.
///
/// This method first clears the class string variable 'WepString';
/// then instatiate an Random object;
/// Then the speudo random generated integer is used
/// as an index to resolves an character
/// in Resources.asciiArray. The speudo random generated integer
/// is actually limited to the max length of Resources.asciiArray.
/// Foreach character resolved in Resources.asciiArray puts
/// the actually result in the class variable WepString.
/// Finally this method returns the combined character string.
///
///
/// (5/13/16/29 bytes for 64/128/152/256-bit WEP
///
public string GenerateStrongKey(int type) {
this.WepString = string.Empty;
Random rdm = new Random();
for (int i = (int)InitialValue.DefaultIntegerStartValue; i < type; i++) {
this.WepString +=
Resources.asciiArray[rdm.Next(Resources.asciiArray.Length)];
}
return this.StringToHex();
}
When creating WepKey's, you must consider using 'strongly generated wepkey's' for your own protection, but that choice is up to you!
More...
http://www.codeproject.com/KB/security/wepkey_generator.aspx
A Wepkey generator for protecting your wireless LAN
Introduction
Whatever bad you may have heard about WEP (Wired Equivalent Privacy) encryption for wireless networks, not using it is asking for trouble. Usually, it is quick and easy to set up, and at the very least, it doesn't cost you anything!
However, generating random WEP keys to use can be a pain - it's difficult to think up new ones, and if you want good security on your wireless network, you need to change them regularly. I found a JavaScript based WepKey Generator at Warewolf Labs and got so inspired, so I had to make a WepKey generator in C#. The entire code was written in JavaScript, and have kindly made the code available free for distribution (many thanks to them for a great job!) Several method calls in JavaScript don't exist in the .NET framework, so I had to create an equivalent for them. The second thing that I had to do was to re-package the entire regenerated C# code into an object oriented jacket. This can be a kind of handy when you want to inherit the WepKey class into your own projects. Using this application, you can generate good strong WEP keys for your wireless LAN! A good primer on WEP key setup and terms is located here.
First of all, this application can be divided into two sections:
One, create a WepKey based on a custom Pass phrase.
Two, generate a pseudo random WepKey by selecting the corresponding length required by your hardware.
First, I had to create a resource for my application to match the entered pass phrases. The first array is a char array that can hold up to 95 most used (ASCII) characters. The second is a string array that holds the same length as the ASCII array.
Collapse
///
/// Two public static array's for serving as a resource
/// witch will be used to match the input (string) value.
/// Both array's share the same index.
///
///
/// These are the 95 most possible characters from witch
/// to choose for generating the WEP key.
///
public static char [] asciiArray = new char[95] {
' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')',
'*', '+', ',', '-', '.', '/','0', '1', '2', '3',
'4', '5', '6', '7', '8', '9', ':', ';', '<', '=',
'>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q',
'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[',
'\\', ']', '^', '_', '\'', 'a', 'b', 'c', 'd', 'e',
'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y',
'z', '{', '|', '}', '~'
};
///
/// 95 HEX value's that uses the ASCII index from above.
///
public static string [] hexArray = new string [95] {
"20","21","22","23","24","25","26","27","28","29",
"2A","2B","2C","2D","2E","2F","30","31","32","33",
"34","35","36","37","38","39","3A","3B","3C","3D",
"3E","3F","40","41","42","43","44","45","46","47",
"48","49","4A","4B","4C","4D","4E","4F","50","51",
"52","53","54","55","56","57","58","59","5A","5B",
"5C","5D","5E","5F","60","61","62","63","64","65",
"66","67","68","69","6A","6B","6C","6D","6E","6F",
"70","71","72","73","74","75","76","77","78","79",
"7A","7B","7C","7D","7E"
};
The first option in this application is to create a Custom WepKey by entering a pass phrase. The custom pass phrase string is separated into characters which have been individual matched in the (ASCII) resource array and returns an integer index number. This number will be re consumed by the second method StringToHex to collect the HEX equivalent, and will be merged into one string that finally will be returned to the caller.
///
/// This method actually iterates trough the length
/// of the passphrase to match each character in
/// the Resources.asciiArray using the method LocateAciiIndex.
/// Finally the actually result is matched in the Resources.hexArray
/// and returns the result in variable string Result.
/// Finally string Result is returned to the caller.
///
public string StringToHex() {
int i = (int)InitialValue.DefaultIntegerValue; int j = i;
string Result = string.Empty;
try {
for (i = (int)InitialValue.DefaultIntegerStartValue;
i < WepString.Length; i++) {
j = this.LocateAsciiIndex(WepString[i]);
Result += Resources.hexArray[j];
}
}
catch (System.IndexOutOfRangeException ex) {
Messaging.WepKeyMessage(ex.Message,
Messaging.MessageIcon.Critical());
}
return Result;
}
The second option in this application, probable the strongest, is to create a pseudo random WepKey. It uses pretty much the same methods; the only thing is that GenerateStrongKey now gives the pass phrase.
///
/// This method first clears the class string variable 'WepString';
/// then instatiate an Random object;
/// Then the speudo random generated integer is used
/// as an index to resolves an character
/// in Resources.asciiArray. The speudo random generated integer
/// is actually limited to the max length of Resources.asciiArray.
/// Foreach character resolved in Resources.asciiArray puts
/// the actually result in the class variable WepString.
/// Finally this method returns the combined character string.
///
///
/// (5/13/16/29 bytes for 64/128/152/256-bit WEP
///
public string GenerateStrongKey(int type) {
this.WepString = string.Empty;
Random rdm = new Random();
for (int i = (int)InitialValue.DefaultIntegerStartValue; i < type; i++) {
this.WepString +=
Resources.asciiArray[rdm.Next(Resources.asciiArray.Length)];
}
return this.StringToHex();
}
When creating WepKey's, you must consider using 'strongly generated wepkey's' for your own protection, but that choice is up to you!
More...
http://www.codeproject.com/KB/security/wepkey_generator.aspx
Wednesday, September 3, 2008
Current Lesson: StringBuilder
StringBuilder
by: Salman Ahmed
String Builder - So you want to learn about the StringBuilder eh?
In Classic ASP we were accustomed to forming sql strings or any other string by concatenating values using '&' that would sometimes span many lines. A fast and efficient way of performing this same task in C# is so much cleaner and a pleasure to work with.
You will find this class in System.Text (namespace). StringBuilder is ideal for appending, removing, replacing, or inserting characters. This size of your string can be modified dynamically, no need to set a size during declaration.
Common usage of StringBuilder would be concatenating string values, replacing values in a string e.g Replacing all occurances of ' with ''
More...
http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=13
by: Salman Ahmed
String Builder - So you want to learn about the StringBuilder eh?
In Classic ASP we were accustomed to forming sql strings or any other string by concatenating values using '&' that would sometimes span many lines. A fast and efficient way of performing this same task in C# is so much cleaner and a pleasure to work with.
You will find this class in System.Text (namespace). StringBuilder is ideal for appending, removing, replacing, or inserting characters. This size of your string can be modified dynamically, no need to set a size during declaration.
Common usage of StringBuilder would be concatenating string values, replacing values in a string e.g Replacing all occurances of ' with ''
More...
http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=13
Subscribe to:
Posts (Atom)