webForumDet fria alternativet

The virtual path 'TesteUserControl.ascx' maps to another application...

.NET

1 svar · 507 visningar · startad av Travoni

Medlem sedan okt. 20041 556 inlägg
Frågan#1

Min "server" crachar när jag kör denna applikation.

The virtual path 'TesteUserControl.ascx' maps to another application, which is not allowed. (På den röda raden)

Någon som vet vad felet är?

public partial class WebPartListControl : System.Web.UI.UserControl
{

   public override bool HasControls()
   {
      return true;
   }

   protected override ControlCollection CreateControlCollection()
   {
      ControlCollection controls = new ControlCollection(this);
      [B][red]Control x = LoadControl("TesteUserControl.ascx");[/red][/B]
      x.ID = "TesteUserControl.ascx";
      controls.Add(x);
      return controls;
   }
}
Medlem sedan okt. 20041 556 inlägg
#2

Ooops, hade visst glömt en thilde här
Control x = LoadControl("~/TesteUserControl.ascx");

261 ms totalt · 4 externa anrop · v20260731065814-full.1dc6f849
123 ms — deklarationer (db)
0 ms — hämta statistik (cache)
129 ms — hämta tråd, inlägg och bilagor (db)
129 ms — ändringar (db)