Publish web site wrror

S

simonZ

When I publish my web site and open the page I get the following error:

[NullReferenceException: Object reference not set to an instance of an
object.]
izpisTV.OnInit(EventArgs e) +84
System.Web.UI.Control.InitRecursive(Control namingContainer) +316
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +694


The error is happening in this method:

override protected void OnInit(EventArgs e)
{
imgC = new ImageButton();
imgC.ImageUrl = "./images/imgC.gif";
if ((Boolean)Application["language"] == true)
{
imgC.Visible = true;
}
else
{
imgC.Visible = false;
}
imgC.CausesValidation = false;
imgC.Click += new ImageClickEventHandler(this.imgC_Click);
ContentPlaceHolder cntPH;
cntPH = (ContentPlaceHolder)Master.FindControl("cntC");
cntPH.Controls.Add(imgC);
base.OnInit(e);
}

In developmnet version everything works perfect. The error is only on
published web site.

What could it be?

Regards,Simon
 
S

simonZ

I found what the problem is:

Application object is not accessible when I publish my site into dll's.
((Boolean)Application["language"] is null

Does anybody know why?

If I just copy all files and create web site than everything works.

I belive that this is a bug.

regards,Simon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top