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

.NET

1 svar · 515 visningar · startad av Travoni

Medlem sedan okt. 20041 556 inlägg
Trådstart#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");

619 ms totalt · 4 externa anrop · v20260731065814-full.d34c6d5a
347 ms — deklarationer (db)
130 ms — hämta statistik (db)
134 ms — hämta tråd, inlägg och bilagor (db)
351 ms — ändringar (db)