Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Mar 2010
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can you mix ASP and .NET pages?

    I am working on a mobile site that uses .aspx for the pages; however, I am transferring information from older .asp pages. These .asp pages are reading database connections, and I am not clear how to convert these into .aspx pages without running into config errors that are unclear to me in fixing.

    Is it bad practice to mix .asp and .aspx pages in a site? If not, how can I learn to better understand the conversion differences from .asp database connections to .aspx? This is the only obstacle I have going on at the moment with this site, and I would love to find a solution soon as I've been stuck here for a while. I do want to follow best practice.

    The site works, but I would like to be consistent with the .aspx set up in pages. I appreciate any help you may have to offer, thank you.

  • #2
    Regular Coder
    Join Date
    Apr 2009
    Posts
    244
    Thanks
    1
    Thanked 20 Times in 20 Posts
    Hey creativeedg10,

    As Chris Rock once said: "You can drive a car with your feet, but it doesn't mean it's to be done."

    I am pretty sure there are some workarounds out there, but ask yourself, do you really want to go that route?

    I will tell you one thing. In my opinion (and I don't think anyone would disagree), the fact that you already know legacy ASP is definitely an advantage to you in terms of leaning .NET. Just go through some tutorials (plenty out there, just Google it)

    Regards,
    Mike

  • #3
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    Quote Originally Posted by creativeedg10 View Post
    Can you mix ASP and .NET pages?
    Yes. You can have some pages as ASP and some as ASP.NET. You can't have both on the same page though, and any communication will be through mechanisms such as cookies.

    Quote Originally Posted by creativeedg10 View Post
    Is it bad practice to mix .asp and .aspx pages in a site?
    Yes. Convert all to ASP.NET.

    Quote Originally Posted by creativeedg10 View Post
    how can I learn to better understand the conversion differences from .asp database connections to .aspx? This is the only obstacle I have going on at the moment with this site, and I would love to find a solution soon as I've been stuck here for a while. I do want to follow best practice.

    The site works, but I would like to be consistent with the .aspx set up in pages. I appreciate any help you may have to offer, thank you.
    http://www.w3schools.com/aspnet/aspnet_dbconnection.asp etc

    In general you will be using Microsoft SQL Server for a DBMS with ASP.NET rather than OLE, so you would be using the System.Data.SqlClient namespace.

    The typical differences are that ASP.NET provides mechanisms for data binding (so you can say here is a grid to display data, and here is the data to fill it with, go fill it for me) and another common stumbling block is that you can only have a single result set open at a time, unless you use MARS (assume you don't when writing). This means you don't nest queries and result sets as you might in asp.

    You can also define your connection string in web.config and not have to compile it into your source.

    If you don't use data binding for a particular task, you will commonly be using an SqlConnection and SqlCommand with SqlCommand.ExecuteReader or SqlCommand.ExecuteNonQuery. These are quite similar to how you would use ado in asp.

    Best practice is likely to be data bind where possible.

  • #4
    New Coder
    Join Date
    Mar 2010
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you all for your insight and help. I am converting over to ASP.NET, got the connections to work, and so far things are coming along pretty good. I am experiencing a learning curve, but I'm willing to learn it too; so it's going well


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •