0

Issue:

I'm trying to upload my ASP.net project files to FTP (for the first time), but the code behind is not running when I load up my website.

Project:

I built a simple test project, with an index.html file and a index.aspx page. The ASP index page has runat="server" so that it can run right away when the website is accessed. On the code behind in the Page_Load method, I have it printing out text in the response Response.Write("I could use some whiskey");.

It prints out the response fine when I run the website locally, however, on my actual website there is no response written to the webpage.

Here are the published files from my project, which I uploaded to FTP:

enter image description here

enter image description here

This should be simple... but maybe I'm not understanding something. I've tried YouTube videos, but most of them cover publishing them through VS. I'd like to upload the files on my own, using Core FTP. Thank you!

I'm Hungry
  • 101
  • 1
  • 6
  • See the answer below for a simple check (index/default doc). That said, if you opt to do "core ftp" then you _should_ have a good understanding of what you will be uploading (or not), settings (debug vs release), etc. [Publishing isn't magical](https://stackoverflow.com/q/14102521/304683) – EdSF Oct 22 '17 at 19:00

1 Answers1

0

Have you entered url of your aspx file? If not, your index.html might be default document so IIS serves it instead of aspx. Upload this code in some hello.aspx file and call it from browser. It will say if .NET is configured correctly as application.

<%@ Page Language="C#"  %>
<%
    Response.Write("hello from NET " + System.Environment.Version.ToString() +"<br>");

    Response.Write("<br>HttpContext.Current.Server.MapPath:<br>" + HttpContext.Current.Server.MapPath("/")); // physical root of application
    Response.Write("<br>HttpRuntime.AppDomainAppPath:<br>" + HttpRuntime.AppDomainAppPath); // The filesystem folder containing your application
    Response.Write("<br>HttpRuntime.AppDomainAppVirtualPath:<br>" + HttpRuntime.AppDomainAppVirtualPath); //
    Response.Write("<br>Request.ApplicationPath :</strong><br>" + Request.ApplicationPath); // Gets the IIS root virtual path for your ASP.net application. ASP.NET transforms ~/ into this value when making an absolute virtual path.
%>
Zoran Bosnjak
  • 326
  • 2
  • 8