Yes, it's difficult. The major differences are due to several things:
1. A Windows Form operates continuously in a single area of memory for the
lifetime of the application. A Web Page operates across a TCP/IP network,
where the client-side browser and the server don't share any memory in
common, but can only pass messages back and forth. In addition, as HTTP is
stateless, each Request re-creates the Page class. Each instance of the Page
class is brand-new, like shutting down your Windows Form and restarting it.
2. A Windows Form has persistent memory. HTTP, on the other hand, is
stateless. Each Request/Response happens without any memory of any
Request/Response that previously happened. It's like 2 senile men trying to
carry on a conversation. Neither one can remember the last thing the other
said. So, ASP.Net has to resort to tricks to emulate some form of continuity
of memory. The 2 senile men pass notes back and forth to remind each other
of the last thing they said. This is done via a combination of the available
resources: Cookies, hidden form fields, temporary server memory storage in
Session, QueryStrings, etc.
3. Any network application works via network messaging; in the case of
ASP.Net, it is HTTP across a TCP/IP network. Therefore, there is no
guarantee that the data sent by either side will make it to the other, or
that it will make it intact.
4. When a user using a Windows Forms app is done, he closes it, freeing up
memory. An ASP.Net application is a service that must serve many users at
any given time, and doesn't shut down unless there are no users, and a
sufficient amount of time has passed. Therefore, there is no way for a user
to tell the server to de-allocate any memory associated with his Session.
The server waits for a Request for about 20 minutes, and if the user has not
made one, shuts down that client Session all by itself. Otherwise, every
user would accumulate more and more memory on the server, and create a very
fast memory leak.
Knowing all of this, you have 2 choices. You can go back to the nice, safe,
and relatively easy sandbox of Windows Form programming (something most of
us dream about from time to time!), or you can accept the challenge, and
move forward with ASP.Net.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.