Помогите, если кто сталкивался с написанием адаптеров под ASP.NET
код следующий:
public class WmlMonsterPageAdapter : WmlPageAdapter
{
public override void Render(WmlMobileTextWriter writer)
{
writer.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
writer.Write("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">\n");
writer.Write("<wml>");
writer.WriteFullBeginTag("head");
writer.Write("<meta http-equiv=\"Cache-Control\" content=\"max-age=0\" />");
writer.Write("<link href=\"main.css\" rel=\"stylesheet\" type=\"text/css\"/>");
writer.WriteEndTag("head");
writer.WriteFullBeginTag("card");
foreach (Control c in Page.Controls)
if (!(c is LiteralControl) && c != null)
c.RenderControl(writer);
writer.WriteEndTag("card");
writer.WriteEndTag("wml");
}
}
на что меня отправляют по следующему адресу:
System.NullReferenceException was unhandled by user code
Message="Object reference not set to an instance of an object."
Source="System.Web.Mobile"
StackTrace:
at System.Web.UI.MobileControls.Adapters.WmlPageAdapter.RendersMultipleForms()
at System.Web.UI.MobileControls.Adapters.WmlMobileTextWriter.ShouldWriteFormID(Form form)
at System.Web.UI.MobileControls.Adapters.WmlMobileTextWriter.RenderBeginForm(Form form)
at System.Web.UI.MobileControls.Adapters.WmlMobileTextWriter.BeginForm(Form form)
at System.Web.UI.MobileControls.Adapters.WmlFormAdapter.Render(WmlMobileTextWriter writer)
at System.Web.UI.MobileControls.Adapters.WmlControlAdapter.Render(HtmlTextWriter writer)
at System.Web.UI.MobileControls.MobileControl.OnRender(HtmlTextWriter writer)
at System.Web.UI.MobileControls.Form.Render(HtmlTextWriter writer)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
at MobsterLibrary.WmlMobsterPageAdapter.Render(WmlMobileTextWriter writer) in c:\Job\Футбол\App_Code\WmlAdapters.cs:line 39
at System.Web.UI.MobileControls.Adapters.WmlControlAdapter.Render(HtmlTextWriter writer)
at System.Web.UI.MobileControls.MobilePage.Render(HtmlTextWriter writer)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.MobileControls.MobilePage.RenderControl(HtmlTextWriter writer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
в чем проблема - не пойму.
На вершине вызова - RenderMultipleForms. Возможно, что при генерации wml забыл отрендерить тэг формы страницы form
а то в упор не понимаю:(
тэг <form/> присутствует в тексте, который рендеришь?
но и при вставлении тега вылезает та-же ошибка
) использовать.
пасиб, попробую завтра:)