web site is hosted, but
it does not occur when I run it under VS2005. I have an errors.aspx
page that captures unhandled application errors. The error I get from
Server.GetLastE rror() is:
"The server cannot fulfill your request."
Scenario: I developed a composite web server control in C# . It is on
a web page in an ASP project I developed with VB as the language. The
web server control has a Close button that I have wired to
the onclick event to raise the "CloseClick " event in the web page,
which pops a messagebox asking user if they want to save changes. This
works on a local machine under VS2005, but on the server that is
hosting the application, when I click the Close button I get the above
mentioned error. I am using one of those virtual hosting companies.
This is a personal project; I do not have servers to test things on,
just my local pc.
I am not sure if it is my code, the configuration on the webserver, or
how to diagnose the problem. I extracted the pertinent parts of the
code for the Close button -there are several controls and other
buttons, but the close button is the only control that causes raises
an event on an .aspx page.
>From the C# class library which I compile to a .dll and add to my webproject.
public class ListSelector : CompositeContro l, IPostBackDataHa ndler
{
public ListSelector()
{
btnClose.Click += new EventHandler(bt nClose_Click);
}
public event EventHandler CloseClick;
btnClose.ID = "btnClose";
btnClose.Enable ViewState = false;
btnClose.Text = this.CloseButto nCaption;
this.Controls.A dd(btnClose);
this.btnClose.A ttributes.Add(" onclick", "return true;");
protected override void Render(HtmlText Writer output)
{
this.btnClose.A ttributes.Add(" onclick", "return true;");
base.Render(out put);
}
protected void btnClose_Click( object sender, EventArgs e)
{
if (this.CloseClic k != null) this.CloseClick (this, new
EventArgs());
}
In the .aspx page the following event captures the button's click
event. This is raised when run
from VS2005, but not on the web server.
Protected Sub ListSelector1_C loseClick(ByVal sender As Object, ByVal
e As System.EventArg s) Handles ListSelector1.C loseClick
Try
If MsgBox("Save changes?", MsgBoxStyle.Yes No, "Moxie
Quotes") = MsgBoxResult.Ye s Then
'several lines of code here
Catch ex As Exception
MsgBox("Unable to save
parameters",Msg BoxStyle.Inform ation)
End Try
End Sub
Bill