Solved

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

Posted on 2011-09-13
4
393 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Server error in 'XXXXXXXX' application. 12 68
c# regex: extract & replace text between braces 6 43
ASP.NET reading ATOM 2 51
Remove greater than sign 3 42
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

929 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now