ASP/ASP.NET and the Web - How doesi t fit? [RESOLVED]
Hi all,
I've done a fair amount of searching both on & off the forums and can't quite find the answer to this question.
How does ASP/ASP.NET really fit within the whole realm of HTML/XHTML?
What I mean by this is, how is a web site/page that might contain an asp page/form usually designed and how is ASP fit into the whole? Is it genereally and object inserted into the HTML page or what? I've done some work with WinForms (VB.NET, primarily). I recently finished a Web Design I class. I now undertsand how the basics of HTML/XHTML work along with Style Sheets, etc. I have a very basic understanding of client/side Jscript. So, what bit am I missing? Can someone enlighten me, or perhaps point me to a reference?
Thanks in adavnce.
Steve
Re: ASP/ASP.NET and the Web - How doesit fit?
ASP.NET allows you to create dynamic websites, in such a way that your code logic is separated from the html you write. For example, clicking a button can make your page insert 500 rows into a database, then retrieve some information from another table and display it on the page. Using plain ol' HTML and Javascript, this isn't possible. You'd need some sort of a scripting language to get this done... and ASP.NET is one of those technologies.
Re: ASP/ASP.NET and the Web - How doesit fit?
Mendhak,
Thanks. I understand the idea of separating the code logic from the static HTML stuff. I gues what I'm trying to warp my head around is this:
In your example, how is this normally done? Do you place a standard webform submit button & then have that run the server side ASP stuff? Do you create the entire form in ASP.NET?
Then to take that a step further, let me descibe a project I just completed for a Web Design class. It was a small site for a "Dog Adoption" center. There were essentially 4 pages. A main home page that was relatively static, a logo accross the top, links along the left and a bit about the organization in the main content area. The logo and link areas a replicated accross the four pages. The second page was a series of "Pet Profile", now this page is somewhat static, but in a real site it might change on a monthly or weekly basis, in my mind the may or may not benefit from using ASP.NET to render it. The final two pages are a calendar/schedule and a registration for. These two pages seem to be obviously ripe for dynamic content and ASP.NET to do things like load the registration data into a database for later use. Now I used an external CSS style sheet to manage the appearance of the site.
So, I gues what I'd like to understand is how ASP.NET might fit into an environment like that. Obviously the ASP.NET code would run on the server, but how would the ASP.NET portion of the site be incorporated into the CSS Style, if I made the first two pages static HTML and the other two ASP.NET, would the last two simply be ASPX pages and be linked that way in the a tag, or would they be embedded objects in an HTML shell page?
I hope this clarifies what I'm trying to understand. I'm not necessarily looking for a definitive answer just a push in the right direction to find the info (unless some CAN give me a definitive answer).
Thanks again for your help,
Steve
Re: ASP/ASP.NET and the Web - How doesit fit?
asp.net can run right alongside HTML pages. so while your main page may be default.htm, you may have a link on this page that points to adoptionform.aspx
on IIS (which is the ONLY web server that runs ASP.NET technology - yes there have been some attempts at others, but IIS is the only REAL one) when a page is requested the server looks at the page extension to see what should be done with it. If it is a simple htm page (static) the server simply serves the page to the person who requested it (the user in their browser) if it is an asp/aspx page the server handles any SERVER SIDE processing that needs to be done before the page is served out. The key here to understand is that the server processes the asp.net pages and renders them as HTML and sends them out to the user. So the user is always getting HTML even if its static or dynamic. When dealing with content that may change you need to evaluate the situation. Sometimes its not enough content to warrant making it dynamic, and its easier on you to simply make changes to a static page and upload them. If its a good amount of info, then you may want to use a database and dynamic content. Anything that is connecting to a database is going to be server side and require server side processing (this includes asp, asp.net, jsp, php, etc...)
Another benefit of server processing is data validation and error handling. Many sites have come to rely on javascript soley to handle the validation users put in. But what if the user has a browser that doesnt have JS? I know you may think at this point everyone SHOULD be using an up to date browser, but you can still disable JS if you want. People actually can hack into sites, or delete data from back end databases by disabling javscript and sending malicious input to be processed on the server. Using a combination of client side and server side validation is key to prevent this. Client side because it can generally handle the majority of validation without requests being sent to your webserver, and server side to handle anything client side may have missed or can simply not handle.
Sorry this is probably a lot of info, and maybe some is more advanced for what you are doing, but I hope it helps
Re: ASP/ASP.NET and the Web - How doesit fit?
Kleinma,
Thanks very much. While I ddn't need all of that info for what I AM doing, It's very relevant to what I WANT to be doing. I'd like to start adding web based development to my repertoire. As I said, I've done some WinForms stuff, but the web is likely to be as, if not more relevant going forward. This class that I just finished up has given me a little insight into HTML & XHTML. I still have much to learn.
The one question I have left is, how can you make an ASP.NET page conform to an external CSS, if the server is generating the HTML code out of the ASP.NET code (I assume written in VB.NET or C# for the most part) then is there a mechanism that allows you to link to the CSS?
Thanks again for everyone's insight.
Steve
Re: ASP/ASP.NET and the Web - How doesit fit?
well when making an ASP.NET page, you get 2 pages basically. one page is the page with the aspx extension, and another page is one with a .vb extension. All the actual server side code goes in the "code behind" page (.vb). This is actually complied into a DLL later with all the .vb files, but lets stay on topic I guess...
in the aspx page, you will find just standard HTML and anything else that would render in the browser like javascript, etc... its the actual page layout you are looking at.
In this standard HTML, you can simply add a CSS right in to the header like u would if it was just a regular htm page.
For example, I have this in one of my aspx pages right inside the HTML <head></head> tags.
<LINK media="all" href="styles.css" type="text/css" rel="StyleSheet">
this applies the style sheet styles.css to my aspx page. This is one way to do it, but there may be others. I found this to be the easiest for what I was doing.
Re: ASP/ASP.NET and the Web - How doesi t fit? [RESOLVED]
Thanks for the info. That sort of helps me put things into perspective. I believe that I understand, at least at a high level now.
Re: ASP/ASP.NET and the Web - How doesi t fit? [RESOLVED]
its ok.. you will learn as you get more hands on with things. Plus you have many resources like vbforums to get help from people who can answer your questions. We have a number of MS MVPs on here like mendhak and even non MVPs (like myself, *sob*, *sob*) are always around to help you.