[Mono-dev] .aspx and .aspx.cs (spliting "codebehind") [SOLVED]

Florian flox at gmx.at
Fri Sep 23 08:58:28 EDT 2005


Salut Pascal,

Thx for the quick and very good advice.
I tried it exactly the same way as you described (just the asp:form as
form) and it actually worked (not just xsp but also mod_mono).

I also found the reason for the problem I had: 
My .dll was called .aspx.dll. I just didn't think about that. 
Mea culpa ;)
If the source file is called something like WebForm1.aspx.cs there also
needs to be Codebehind="WebForm1.aspx.cs" to be added and the dll still
has to be called WebForm1.dll.

Thx again for the help.

a+,
Flox

On Fri, 2005-09-23 at 00:14 +0200, Pascal Fresnay wrote:
> Le jeudi 22 septembre 2005 à 19:39 +0200, Florian Kinast a écrit :
> > Hi Everybody,
> > 
> > I am sorry if this problem is not appropriate here, but I am looking for
> > a solution to that now for some time.
> > 
> > Problem:
> > 
> > I got a request.aspx which works if I put the "codebehind" and the aspx
> > in one file.
> > If I try to split it into a request.aspx and request.aspx.cs it doesn't
> > work anymore: There is just no reaction on the click (it seems to load, but
> > just the same pages comes back).
> Please try this simple test :
> WebForm1.aspx :
> <%@ Page language="c#" Inherits="WebForm1" %>
> <html>
> 	<head>
> 		<title>Test</title>
> 	</head>
> 	<body>
> 		<asp:form id="Test" method="post" runat="server">
> 			<asp:Button id="button1" runat="server" Text="Hello"/>
> 			<asp:Label id="label1" runat="server"/>
> 		</asp:form>
> 	</body>
> </html>
> 
> WebForm1.cs :
> using System;
> using System.Web.UI.WebControls;
>  
> public class WebForm1 : System.Web.UI.Page
> {
> 	protected Button button1;
> 	protected Label label1;
>  
> 	override protected void OnInit(EventArgs e)
> 	{
> 		button1.Click += new System.EventHandler(button1_click);
> 		base.OnInit(e);
> 	}
>  
> 	private void button1_click(object sender, EventArgs e)
> 	{
> 		label1.Text = "Hello World !";
> 	}
> }
> 
> mcs WebForm1.cs -target:library -out:bin/WebForm1.dll -r:System.Web.dll
> xsp --port:8081
> http://localhost:8081/WebForm1.aspx
> Does it works ?
> 




More information about the Mono-devel-list mailing list