Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-09-13
4
Medium Priority
?
400 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

610 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