1

I am facing some problem to get an code behind file. Just like in asp.net, webforms (sample.aspx) contains a code behind file (sample.aspx.cs).

Just like this can I get a code behind for webpage (.html) in Visual Studio. Is there any option if yes can you tell me? If no is there any options to perform CRUD operations to database? (means I want to user code behind file for connecting to database and perform operations using html) how can I?

Thanks.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Nag
  • 489
  • 3
  • 6
  • 27
  • 1
    HTML files do not have a code behind. You can create a new web form (say webpage.aspx) and copy the HTML from webpage.html into the web form file. – Candide Feb 18 '16 at 05:13
  • Is there any drawback to use webforms instead of html? and is there any chance to use html?if i use html then how can i write c# code?thanks – Nag Feb 18 '16 at 05:16
  • HTML is static content, which means, that the web server can return it immediately to the user. So, there is some overhead to web forms, but generally, if you need to write C# code, then, you have to use web forms. – Candide Feb 18 '16 at 05:28
  • @Candide Thanks for your suggestion. What is some overhead to webforms?thanks. – Nag Feb 18 '16 at 05:31
  • To quantify it, it will depend on your server, whether you use sessions or not, and how the page generation looks like, and whether you're in a NLB cluster or not. It is not possible to give one value. My suggestion is that you use web forms, and if you really need the extra performance, you will have learned enough by then to delve into webform page caching. – Candide Feb 18 '16 at 08:25
  • @Candide, Yes thank you. – Nag Feb 18 '16 at 11:24

1 Answers1

0

You might want to see my answer for a related question. Now, it looks like you want more: you want to also process form data input by the user on an HTML page and store the data in a database. You can do this also. David Medinets posted an example of how to do something like this; he created a web-based guestbook and stored the data in a data file using CGI. Now, if you want to update/delete data in a relational database, you might consider reading up on Database Programming in Perl.

ShieldOfSalvation
  • 1,297
  • 16
  • 32