?
Solved

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

Posted on 2011-09-13
4
Medium Priority
?
398 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 36

Assisted Solution

by:Miguel Oz
Miguel Oz earned 800 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 400 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 800 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month11 days, 2 hours left to enroll

770 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