asp codes wont be executed on server - asp.net

I'm pretty new with ASP , but Im looking for an answer to this question and nothing found yet.
Im using an Apache server to upload my website on it. i write a very simple asp code like this:
<!DOCTYPE html>
<html>
<body>
<%
response.write("My first ASP script!")
%>
</body>
</html>
and save the file as file.asp & get this as result:
Is the problem Apache server or what? What Should I do?

You need to configure your server to process ASP pages.
Start with this Running ASP.Net on a Linux based server
If you are using old legacy ASP (not ASP.NET) then you may have trouble this platform is not actively developed from more than 10 years now. It would be better to switch to more modern framework e.g. ASP.NET.

Use a IIS web server rather. Moreover is it asp.net or classic asp? By any means if it results in <%response.write("My first ASP script!")%> that means web server somehow processing it a normal HTML and not understand the script block <% %> which can only happen if it's processed by ASP.NET dll or ASP dll.

Related

Mixing ASP.NET pages with ASP Pages in windows server 2003 IIS

I've got a lot of Classic ASP pages in production on a Windows Server 2003 64-bit machine. I've also got .NET on there working.
I'm starting to move the ASP ajax pages (pages that receive ajax calls from the Classic ASP) to ASP.NET/C# to take advantage of the business/data/logging layer I've got set up there in C#.
I've figured on securing the ASPX pages by way of a "token" that I create in the database in ASP and then pass to the ASPX page, which then uses it to validate that it's a legit call and destroys it.
My big question is - aside from making the ASPX pages, do I need to compile the app into the same site as the ASP site? I assumed I'd do that - deploy it there alongside the ASP Classic pages, and then just call the ASPX individually as needed.
Is this strategy sound? Do I need to do anything special for performance or configuration to make ASP Classic and ASP.NET coexist well?
Thanks - this migration has been a bear because of the extreme asp classic dependency.
It will work just fine. I've seen it on several sites. Just put them all in the same directory.
Your biggest issue will be that the ASP and ASP.NET pages will each have their own SESSION and APPLICATION variables which won't be shared between the two. If you are using session variables in either it can force you into doing a lot of hacks to make it all work together well.

How is an ASP.NET read by the browser?

How does the browser interpret an ASP.NET webpage, hosted in IIS?
The first time the webpage is accessed, is something installed in the browser? Or ASP.NET creates "normal" HTML pages?
IIS interprets and executes the ASP.NET code and markup and sends HTML to the browser.
The browser interprets the HTML.
ASP .NET is server side. It executes remotely and delivers standard HTML page to browser
"An ASP.NET page has the extension .aspx. If a browser requests an
ASP.NET page, the server processes any executable code in the page,
before the result is sent back to the browser."
Quoted from w3schools website.
The first time the asp.net page is accessed it is compiled into a .net class (together with the code behind). There is a so called ISAPI filter installed into iis. When you access an asp.net page (a file with .aspx extension) iis will use the ISAPI filter to execute the request using class that has been compiled.
everything you need is HERE my friend

Response.write with classic ASP page on IIS7

The following statement will not work with a classic asp page on an IIS7 website
<% Response.Write("test") %>
Have you enabled ASP inside Windows features?
I figured out that it had to do with adding a handler mapping for server side includes. When I added a module mapping ServerSideIncludeModule with request path of *.asp, it broke my site.

ASP in a .html file under .net 4.0

I'm updating a site from asp.net 2.0 to asp.net 4.0.
I'm running IIS 7.0.
If I create test.asp and browse to it it works.
If I rename the file test.html it will not parse the asp.
I need html to be parsed as asp because of the CMS we use.
Relevant code from test.html:
<%
Response.Write ("The time on the server is: " & Time())
%>
I think my trouble comes from the way .net 4.0 handles requests.
How do I get IIS to parse html as asp?
You will need to associate the same DLL that currently handles your .asp pages to also handle your .html pages in IIS. see here for help with that
I don't see the connection between ASP and .NET here.
Are you trying to figure out why the ASP engine is not processing a file with the .HTML extension?
When you name a file with the .ASP extension, it will be processed by the ASP engine. When you name a file with some other extension, like .HTML, it will not be processed by the ASP engine so any ASP-specific markup in it will go through to the client.

.ASP Do I need to compile?

I'm poking my head around ASP for work and I'm not sure how it works... I'm used to being able to create a HTML, PHP, ColdFusion page, put it on the webserver and execute it.
Do I need to compile ASP pages or is that just ASPX?
I just want to create an ASP page and put it on my web server to test...
You can just create an ASP or ASPX page and put it on the server to test. The web server in all those cases (ColdFusion, PHP, ASP, ASP.NET) takes care of compiling the page when it's accessed.
In ASP, I believe it is compiled(/interpreted) every time you load it, where as in ASP.NET it's compiled on first access (which is slow) and the compiled version is available for the next page load.

Resources