Solved

Write vb.net code in page.aspx, or page.aspx.vb ?

Posted on 2011-09-13
4
394 Views
Last Modified: 2013-11-05
Hello,
I would like from someone to explain is it better to write vb.net, or C# code inside of page.aspx, or behind page.aspx.vb(c#)?

My thoughts:
1.'m used to write vb.net, c# codes in page.aspx.vb(c#), and also sense is telling me, if Page.aspx has less lines, then pages are more quicly loaded ?!
2.But, in other side, if vb.net, c# codes are written inside of page.aspx, then codes are faster executed?!

False/True ?

Thank you in advance for help to anyone!
0
Comment
Question by:dejandejanovic
4 Comments
 
LVL 35

Assisted Solution

by:Miguel Oz
Miguel Oz earned 200 total points
ID: 36532709
1. false, asp.net will join both aspx and code-behind(C#, vb) as one resource.
2. False, location is not important.
aspx and code-behind separation is done to allow developers to have a clear separation between User interface and code.

How you design your code  and our page contents will influence the performance.
0
 
LVL 7

Assisted Solution

by:mr_nadger
mr_nadger earned 100 total points
ID: 36535417
as an extension to previous poster's comment, maintaining the seperation between the page design and the code will help keep your code cleaner and better organised, helping anyone who has to support your page.
It also makes it a little easier to copy code into other projects ;)
0
 
LVL 9

Accepted Solution

by:
sachinpatil10d earned 200 total points
ID: 36535440
Coding c#/Vb .net using the code behind is always good

Code-behind refers to code for your ASP.NET page that is contained within a separate class file. This allows a clean separation of your HTML from your presentation logic

code-behind can be deployed in dll which works faster.

mycodebehind.aspx
mycodebehind.cs

Syntax to compile codebehind

csc.exe /out:mycodebehind.dll /t:library mycodebehind.cs

code-behind page inherits from the Page class

Inheriting from the Page class gives the code-behind page access to the ASP.NET intrinsic objects, such as Request and Response

you can reference the code-behind class by using an SRC tag
In this case, ASP.NET compiles the code-behind page on the fly.

When you use Microsoft Visual Studio .NET to create ASP.NET Web Forms, code-behind pages are the default method. In addition, Visual Studio .NET automatically performs precompilation for you when you build your solution. Note that code-behind pages that are created in Visual Studio .NET include a special page attribute, Codebehind, which Visual Studio .NET uses.
0
 

Author Closing Comment

by:dejandejanovic
ID: 36536302
Cool. Thanks for explanation.
0

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question