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.GetLastError() 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 : CompositeControl, IPostBackDataHandler
{
public ListSelector()
{
btnClose.Click += new EventHandler(btnClose_Click);
}
public event EventHandler CloseClick;
btnClose.ID = "btnClose";
btnClose.EnableViewState = false;
btnClose.Text = this.CloseButtonCaption;
this.Controls.Add(btnClose);
this.btnClose.Attributes.Add("onclick", "return true;");
protected override void Render(HtmlTextWriter output)
{
this.btnClose.Attributes.Add("onclick", "return true;");
base.Render(output);
}
protected void btnClose_Click(object sender, EventArgs e)
{
if (this.CloseClick != 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_CloseClick(ByVal sender As Object, ByVal
e As System.EventArgs) Handles ListSelector1.CloseClick
Try
If MsgBox("Save changes?", MsgBoxStyle.YesNo, "Moxie
Quotes") = MsgBoxResult.Yes Then
'several lines of code here
Catch ex As Exception
MsgBox("Unable to save
parameters",MsgBoxStyle.Information)
End Try
End Sub
Bill