View: 2408|Reply: 6
|
ASP.Net Programming Techniques
[Copy link]
|
|
Baru blajar nak guna ASP.Net.
Nak tanya
1. Yang mana lagi baik, tulis code sebagai script dalam html atau tulis dalam *.aspx.vb ?
2. Apa kelebihan dan kekurangan dua cara di atas?
Thanks. |
|
|
|
|
|
|
|
kalu baby lebih suka masukkan code dalam html sebab mcm cerewet jer nak masukkan dalm aspx.vb..
tapi terpulang..dari segi security tak pastilah plak....:? |
|
|
|
|
|
|
|
kalau tulis script dalam code html, baik buat pakai ASP aje, takpayah buat pakai ASP.NET
yang bagus buat *.aspx.vb is that nanti dia akan compile as dll file, (macam u buat java classes untuk JSP la), maknanya org tak boleh nak curik your code behind, and (purpotedly) the code runs faster and more efficient if it is compiled in dll. furthermore, this promotes object-oriented programming practices in ASP.NET as you can distribute common libraries if you wish to develop another web application (eg: save data to database, open database connection etc etc...)
script dalam ASP.NET within usually untuk handle request (POSTDATA) and session variables mostly. |
|
|
|
|
|
|
|
agree with shanaz,
a good practise is to separate your logic from the presentaton layer(html).
code behind serves as the business layer. and you shoud also consider the data layer(like stored procedures) . just like any other 3tier rmodel app.
Btw some scripts can be put in the html as the client processes such as simple validation, functions etc.This can be faster and save server resources.
regards |
Rate
-
1
View Rating Log
-
|
|
|
|
|
|
|
So maknanya, server cuma akan compile aspx.vb jer laaa eekk?? Actually apa beza yg plg ketara antara ASP ngan ASP.NET. |
|
|
|
|
|
|
|
Advantages of Using Code-Behind
豙/size] Clean separation of HTML and code
Allows designers and developers to do what they do best independently.
豙/size] Easier reuse
The code that isn抰 mixed with HTML (like in ASP classic) can be more easily reused in other projects.
豙/size] Simpler maintenance
Because the code separated from HTML, it is easier for you to read and maintain. |
|
|
|
|
|
|
|
Originally posted by aks_berhad at 6-1-2007 02:31 AM
So maknanya, server cuma akan compile aspx.vb jer laaa eekk?? Actually apa beza yg plg ketara antara ASP ngan ASP.NET.
Classic ASP developers (users of version of ASP before ASP.NET) named all their ASP files with the extension .asp instead of .aspx. You can continue to name your ASP files with the extension .asp, but they do not gain any of the new functionality of ASP.NET.
Files with the .asp extension continue to be executed as classic ASP files.
By default, files with the extension .asp are mapped by IIS to asp.dll, and .aspx are mapped to _aspnet_isapi.dll. So both classic ASP files and ASP.NET files can happily live and work together on the same Web server.
[ Last edited by ng58339 at 16-1-2007 12:30 PM ] |
|
|
|
|
|
|
| |
|