To create a dll follow the below steps

Open 'Visual Studio' and select File -> Open -> New ->Project




Click on ok Button. Once you click on Ok 'Button' your Class Library looks as follows.




Now you can add you code what you need.Here I am taking one Return data type String function. This function I will use in another project (.aspx) and showing the Result in a TextBox.

namespace MyClassLibraryConsole
{

public class Class1
{
public string strfunction(string input)
{string strmessage = input;
return strmessage;
}
}
}
Now you have to call this function in another project.Add New (or)Existing Project to your Solution.Here i am adding Existing .aspwebpages to my solution as follows.


Once you added your New or Existing Project your Solution will looks as follows 



Adding created dll file to .asp solution:-
Ricght click on DllDemo(.asp) solution and click on the select 'Add Reference'.

Now you can find dialog Box.Select 3rd tab 'Projects'.Now can find your created ClassLibrary(dll) as 'MyClassLibraryconsole'.Select it and click 'OK' button.

Now your dll is added successfully to your website.You can see your added dll in solution Explorer.

Calling dll file function in .aspx.cs page:-

protected void Button1_Click(object sender, EventArgs e)
{
MyClassLibraryConsole.Class1 obj = new MyClassLibraryConsole.Class1();
TextBox1.Text = obj.strfunction("Hellow World");
}

Showing the Result in TextBox