how main use in website......

  • Thread starter Thread starter vimal.424
  • Start date Start date
V

vimal.424

can any body tell me,
if we are working on the website in c#.
then how will we use main() wih page load
 
ur problem is not clear . why ur using main in page there is already page
events
 
It looks like you are looking at a Console app or a Windows Forms app,
which you can't use in a website. You need to choose a new ASP.NET project
in order to create a website.
 
Further to the other replies - if you want something that fires when
your web app starts, then you might look at "global.asax"; you can
place code in here, for instance "Application_Start". This is
comparable* (but not equal) to Main(). However; this Application_Start
method should only be used to perform any initial startup operations
(perhaps more comparable to the code for starting a winnt service); it
shouldn't block etc.
You aren't guaranteed to get any shutdown notification - app-pools can
be torn down without notice.

The following isn't the best walkthrough of global.asax I've seen, but
it is the first I can find (via google) at the moment:
http://samples.gotdotnet.com/quickstart/aspplus/doc/globalasax.aspx

*=actually, it is perhaps more closely compared to an IHttpModule, if
you are familiar with that

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top