Wednesday, 28 March 2012

What is the Difference Between Aspx and Ascx page

The .aspx is the actual page, what the user views in their browser, the .ascx is a custom user
control that is used in the .aspx page. You cannot display a .ascx file in a web browser, just
the .aspx page.

.Aspx:

1 .aspx extension is used for web forms.

2 ASP.NET Page uses the extension .aspx For eg: Default.aspx

3 ASP.NET Page begin with a Page Directive. For eg:
           <%@ Page Language="C#"
           AutoEventWireup="true"
            CodeFile="Default.aspx.cs"
            Inherits="_Default" %>

4 Usercontrol is code which can be used in webforms.

5 ASP.NET Page can be viewed directly in the Browser.

6 ASP.NET Page has a HTML, Body and Form Element

.Ascx:

1 .ascx extension is used for user control .

2 User Control uses the extension .ascx For eg: WebUserControl.ascx.

3 User Control begin with a Control Directive. For eg:
               <%@ Control Language="C#"
                AutoEventWireup="true"
               CodeFile="WebUserControl.ascx.cs"
                Inherits="WebUserControl" %>
4 You can not use webforms in usercontrol.

5 The main advantage of user control is reusability ,u can this control in any number of webforms.

6 User Control cannot be viewed directly in the browser. User Controls are added to WebPages and you view them by requesting a web page in your browser.

7 User Control does not have a HTML, Body or Form element. It is hosted inside an ASP.NET Page.






9 comments:

  1. Very helpful, thanks!

    ReplyDelete
  2. I love the blog. Great post. It is very true, people must learn how to learn before they can learn. lol i know it sounds funny but its very true. . .
    python Training in Pune
    python Training in Chennai
    python Training in Bangalore

    ReplyDelete
  3. Useful post, thank you!

    ReplyDelete
  4. This post is so interactive and informative.keep update more information...
    DevOps course in Tambaram
    DevOps Training in Chennai

    ReplyDelete
  5. I really appreciate your clear and concise explanation of the differences between .aspx and .ascx pages. Your blog provides valuable insights for developers, making it easier to understand their distinct roles. Great job!
    you can also visit:
    Python and Big Data: Analyzing Massive Datasets

    ReplyDelete