You need to know that
is the member of
On its use, please see my past answers:
Control.Invoke() vs. Control.BeginInvoke()
Problem with Treeview Scanner And MD5
To port the code to ASP.NET you would need to write it again. The programming models are too different to discuss it seriously. First of all, you need to learn how Web and HTTP work, as well as .NET and programming in general. So far, you have problem understanding classes and their members, so I would advice not to rush into ASP.NET and other advanced topics. Further detail would depend on your goal you did not share with us. At least, do you understand that you can only work with your serial port on server side? I don't know what is connected to it and why.
Your code has other problems, I don't want to discuss them now, especially if you want to migrate to ASP.NET; so I just answered your questions.