Does ASP.Net work in free accounts?

Status
Not open for further replies.

rhumbaflappy

New Member
Messages
18
Reaction score
0
Points
1
Hi all.

Does anyone have a working example of ASP.net in the free accounts? I'm on boru and it doesn't seem to work there.

Dick
 

rhumbaflappy

New Member
Messages
18
Reaction score
0
Points
1
No one has any working example of ASP.Net.

Everyone reads the tutorial, and everyone gets the same problem:

XML Parsing Error: no element found
Location: http://www.ludowise.x10hosting.com/HelloWorld.aspx
Line Number 1, Column 1:

It just doesn't work. This has been going on for months, with all users... just read the tutorial posts yourself, and you would see that is the case.


Dick
 

masshuu

Head of the Geese
Community Support
Enemy of the State
Messages
2,293
Reaction score
50
Points
48
Code:
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Reflection" %>
<%
  Response.ContentType = "Text/Plain";
  Response.Write("HELLO WORLD!\n\n");
  Response.Write("ASP.NET version is " + System.Environment.Version.ToString());
  Response.Write("\n\n");
  Type monoRuntimeType;
  MethodInfo getDisplayNameMethod;
  if ((monoRuntimeType = typeof(object).Assembly.GetType("Mono.Runtime")) != null && (getDisplayNameMethod = monoRuntimeType.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.DeclaredOnly | BindingFlags.ExactBinding, null, Type.EmptyTypes, null)) != null)
    Response.Write("Mono Verson: " + (string)getDisplayNameMethod.Invoke(null, null));
  else
    Response.Write("Mono.Runtime.GetDisplayName not implemented(probably on windows?)");


%>
that works
http://com.x10hosting.com/test.aspx

ASP.net is run under mono on a linux server, so there are some considerations you need to keep in mind.
.net 2.0 is fully supported, have not tested 3.5 or 4, though technically those should be supported, since the mono version is 2.6
filenames are case sensitive under linux, so default.aspx.cs is not the same as Default.aspx.cs
Use forward-slash /////// when accessing stuff(IE: File.ReadAllLines("./data/SomeDirectories/MoreStuff/someData.xml"))
Otherwise your scripts should work.



[edit]
The tutorial is full of large holes.
http://com.x10hosting.com/test2.aspx
that is the fixed tutorial, and it works.

Here is a modified version of his tutorial:
Make sure to use the file names exactly as shown
Code:
<!-- this line is for C# projects -->
 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="HelloWorld.aspx.cs" Inherits="HelloWorld" %>
Or
Code:
<!-- this line is for VB.Net projects -->
 <%@ Page Language="VB" AutoEventWireup="false" CodeFile="HelloWorld.aspx.vb" Inherits="HelloWorld" %>
And this is the rest of xhtml for both languages:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">
          <title>Hello World!</title>
 </head>

<body>

    <form id="form1" runat="server">
        <div>
               <asp:Label ID="Label1" runat="server" Text="Erm, Hello World!"></asp:Label>
               <br />         <br />
               <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Press Me" />
        </div>

    </form>

</body>
 </html>
That’s the html sorted. Now on to the code-behind file.

C# HelloWorld.aspx.cs:
Code:
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

  public partial class HelloWorld: System.Web.UI.Page
 {
        protected void Button1_Click(object sender, EventArgs e)
       {
            Label1.Text = "Asp.Net post test worked.";
       }
 }
Or
VB.Net HelloWorld.aspx.vb
Code:
Partial Class HelloWorld
     Inherits System.Web.UI.Page

     Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)
            Label1.Text = "ASP.Net post test Worked"
     End Sub

End Class
 
Last edited:

rhumbaflappy

New Member
Messages
18
Reaction score
0
Points
1
Hi masshuu.

Something is still amiss for my account.

I used this code ( as Test.aspx ):

Code:
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Reflection" %>
<%
  Response.ContentType = "Text/Plain";
  Response.Write("HELLO WORLD!\n\n");
  Response.Write("ASP.NET version is " + System.Environment.Version.ToString());
  Response.Write("\n\n");
  Type monoRuntimeType;
  MethodInfo getDisplayNameMethod;
  if ((monoRuntimeType = typeof(object).Assembly.GetType("Mono.Runtime")) != null && (getDisplayNameMethod = monoRuntimeType.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.DeclaredOnly | BindingFlags.ExactBinding, null, Type.EmptyTypes, null)) != null)
    Response.Write("Mono Verson: " + (string)getDisplayNameMethod.Invoke(null, null));
  else
    Response.Write("Mono.Runtime.GetDisplayName not implemented(probably on windows?)");


%>
The code gives me a reply:

XML Parsing Error: no element found
Location: http://www.ludowise.x10hosting.com/Test.aspx
Line Number 1, Column 1:



http://www.ludowise.x10hosting.com/Test.aspx

However at Somme I can get a proper response:

HELLO WORLD!

ASP.NET version is 2.0.50727.3607

Mono.Runtime.GetDisplayName not implemented(probably on windows?)

http://www.ludowise.somee.com/Test.aspx

So I have to believe I have something missing ...

cPanel File Manag&#1.png
 

masshuu

Head of the Geese
Community Support
Enemy of the State
Messages
2,293
Reaction score
50
Points
48
Hmm, that is not right. Need an admin to look at mono on the server you are on.
 
Status
Not open for further replies.
Top