Creating a Public and Private Key using C#

Requirements:

  • Folder named “Keys”
  • New Class named “PrivatePublicKey.cs”
  • An ASPX page with any name

Class PrivatePublicKey Imports

using System.IO;
using System.Security.Cryptography;

Class PrivatePublicKey Methods

public void CreateKeyPairs(string publicprivatepath, string publicpath)
{

FileStream filekeypair = new FileStream(publicprivatepath, FileMode.Create);
FileStream filepublickey = new FileStream(publicpath, FileMode.Create);

StreamWriter sw = new StreamWriter(filekeypair);
StreamWriter sw2 = new StreamWriter(filepublickey);

RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();

string publicPrivateKeyXML = rsa.ToXmlString(true);
sw.Write(publicPrivateKeyXML);
sw.Close();

string publicOnlyKeyXML = rsa.ToXmlString(false);
sw2.Write(publicOnlyKeyXML);
sw2.Close();

}

ASPX Page

Create a new Folder named “Keys”

Create a new ASPX page and name as wished

Add an input field such as: <asp:TextBox ID=”txt_username” runat=”server”></asp:TextBox>

Insert the following code where desired, preferably on Register Click Button Event:

string Username = txt_username.Text;

PrivatePublicKey pp = new PrivatePublicKey();

string keyPair = “../Keys/” + Username + “pair.xml”;        //Creating an XML file with both the Private and Public Key

string keyPublic = “../Keys/” + Username + “public.xml”;      //Creating an XML file with only the Public Key to be shared

pp.CreateKeyPairs(Server.MapPath(keyPair), Server.MapPath(keyPublic));

Microsoft SQL Server Error 3415

I had a database which I detached while still using SQL server 2005. Now that I have upgraded to Server 2008 I was receiving a 3415 error message each time I attempt to attach it to a new Database. I have read a lot of posts that I need to download this and that, or that I need to do this and that, nothing worked. I was not sure if I felt upset or stupid when I realised that all I needed to do is enable my PCs permissions. To do so, you need to:

  • Open the “User Account Control Settings” (type in Start if using Vista or Windows 7)
  •  Scroll down permissions to “Never Notify”
  • Click OK
  • ENJOY :)

Error: You cannot save changes that would result in one or more tables being re-created

When trying to save something to a table, such as new fields or isNull tick box, set primary keys or change data types, the above error may pop up. This may happen due to attempts to:

  • Change data type on existing columns such as text to varchar
  • Check allow nulls or uncheck allow nulls on existing columns
  • Change column sizes
  • Change foreign key constraints

The solution is easy, if you already have the SQL Management Studios,

  • click Tools, select Options
  • from the pop up, select Designers from the left side menu
  • Uncheck the “Prevent saving changes that require table re-creation” as shown below
  • Save

 

If you are using the built in SQL server express in-built in the Visual Studio 2008 or 2010, you are required to download the SQL management studio 2008 and possibly also the SQL Server 2008 Service Pack 1 (try without installing Service Pack 1 first)

Available from:

Sql Management Studio 2008: http://www.microsoft.com/download/en/details.aspx?id=7593

Sql Service Pack 1: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=20302

 

Error: The data types text and text are incompatible in the equal to operator

 

Image

 

While taking security measures to hash password I chose text as a datatype, what I did not know is that the such type is considered as a blob type and is very limited. Comparing text with text is one of such limitations. To fix this problem I had to change the type of the Password to varchar(150) to make space for the hashing and other security measures.

Only servers up to Microsoft SQL 2005 are supported

 

only servers up to 2005 are supported
When trying to connect a new Database Connection to the Visual Studio 2008 or higher, a support problem comes up stating that only servers up to 2005 are supported.

This can easily be solved by installing the Visual Studio Service Pack 1 available from http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=13276 ready in iso format.

Analysing and Selecting Keywords for your SEO

When optimizing a Website to be more search-engine friendly, keywords are one of the most important factors to take into consideration. The right keywords or combination of keywords might bring along a large number of visitors to your page. On the other hand, the misuse of keywords can push search-engines away. We will start on explaining how to identify the right keywords to compete better against your competition. Once we have finished with keywords, we will properly explain how to best implement them into your website.

Please note that this is a shorter version of a full document explaining each topic in details. To view the full explanation, visit Selecting Keywords from AboutSEO Malta.

Optimizing Keywords for Search-Engines

Head Terms and Tail Terms

Keywords can be considered as either Head terms or Tail terms. Head terms refer to short (one or two words) phrases while Tail terms refer to longer (three or more words) phrases. Head terms tend to be of a more competitive nature therefore tail terms may be easier to rank for.

Determining better Tail Terms which compete for search-engine results:

  • Use Geo-Specific Terms
  • Use Synonyms for the main
  • Common misspells are very important when selecting the right keywords.
  • Include also plurals and singulars of the most important keywords.
  • Analyse your competition by visiting their website and view their source.

Keyword Tool to help you select appropriate Keywords for your website

  • WordTracker
  • Google Keyword Tool

Other tips to keep in mind

  • One or Two keywords should be targeted for each page. Each page must have unique or different keywords.
  • Every page should contain unique and meaningful content.
  • Home Pages should target competitive Head terms since it has a higher chance to rank for high KEI keywords.
  • Home Pages should emphasis the keywords targeted in the page contents.
  • Sub Pages should target less competitive Head terms and Tail terms.
  • New website may find it hard to compete for common Head Terms such as “SEO” but such Head terms can be broken down into more specific Tail terms such as “SEO services in Malta”.
  • Reverse engineering demonstrates that the higher the search of a keyword, the more optimized it can become.

Check competing websites

Competing websites and keywords are important to be analysed. Various websites offer this service, such as compete.com or keycompete.com. Such websites require the input of a URL and result keywords competitors are using and where they stand. Another simple way to do check what tags and keywords competitors are using is to visit their website and view source. Title, Description and Meta Keyword tags are situated in the <HEAD> section while; headlines, image ALT tags, text modifiers and links are situated in the <BODY> part.

SEOdigger.com is a website which looks up websites and returns their top searches and competitors. Not all websites may be found on SEOdigger.

How do Search-engines Work?

Search-engines

For the simple reason that Google was developed for school purposes, at Stanford University, enough information on how it works was published in papers. Therefore, a lot can be determined on how it works. Meanwhile other search-engines, which were developed primarily for commercial purposes, tend to keep their techniques publications at a minimum. From what is published by Google, a clear understanding can be generated about how Google itself works and also gives a general idea on how other search-engines may work.

What made Google successful was the drastic improvement in their algorithm to make sure to present the user with the highest quality pages in relevance with the search query within the first top 10 results. This has mainly been emphasized since it had been noted that users tend to look only through the first result page, usually having ten result links.

Google uses a lot of different factors to determine which pages are of better quality than others. PageRank is one of the most affective factors used by Google’s search-engine. PageRank is assigned to every page Google crawls (visits and indexes) and can be affected in various ways. The PageRank of a page can be determined on the amount of other pages linking to it, by who links to it, how many hits it receives and the page relevance data. Each page containing links is able to pass on its PageRank to the outgoing links so a link from a very high PageRanked page may be considered to be of better importance than hundred links from low PageRanked pages.

 

Please note that all information has been provided by: About SEO Malta which is an open source SEO information website.

Writing your content for Search-Engines

When search engines crawl websites, they give great importance to the value of information it gives to the reader. This means that old tricks to fill up nonsense content to attract search-engines are no longer applicable. On the other hand, it would actually leave a negative affect while indexing. This change is mainly due to Google’s update known as the Panda Update or Farmers Update. This has been affected in order to make sure that Google users are provided with the best results with good information and user experience.

A well optimized website must also contain well-written content intended for both readers and search engines. Keywords must be properly amalgamated with the content to make perfect sense and of course must be related to the page’s context.

To continue reading about the main tips to create well-written website content visit Creating Web Content – AboutSEO Malta.

A little on how Google works

When a person performs a search, Google uses an algorithm to determine which website and pages to return. The whole algorithm is unknown to all, but the main procedure is quite public. Google starts by crawling through all the websites available. Several Computers are dedicated to crawl through millions of pages. This process is called Google bot or Google spider and it starts by crawling a set of indexed URLs and by following each link on every page, it identifies new and updated pages to index. Any broken links will be negatively noted down on Google index. Once crawling is complete, Google goes through all indexed pages and analyse each page content such as tags, keywords, etc. The more relevant the keywords to the search, the higher value the page will have to the user’s search.

Web Design tips for better Search-Engine Optimization

Splash Pages

A while back, a website was considered professional if it had flashy animation, a lot of graphics and sound animations, intro pages and so on. All of these may affect search engine crawlers when trying to read your content, links, tags, etc. The following article explains different methods which should be followed in order not to negatively affect search engine optimization.

Website Design for better Search-Engine Ranking explains how to properly create:

  • Main Pages or Intro Pages: Flash pages,  JavaScript, Photoshop, Images, etc
  • Navigations / Menus: Flash Menus,  JavaScript Menus, Photoshop Slicing for buttons, Images, etc
  • Head Meta Tags: title, description, keywords meta tags
  • Page Content: Images, same content
Follow

Get every new post delivered to your Inbox.