Last post Mar 22, 2010 07:52 AM by clarkeyb0y1987
Mar 21, 2010 08:50 PM|clarkeyb0y1987|LINK
I have a set up whereby I have a class called Page, which extends the default Page class. Two more classes (also called Page, but in namespaces Customer and Administration) inherit from Page. Another class in the Validation namespace (Validation being a
big section of my site) inherits from the Administration.Page class.
Administration.Page and Administration.Validation.Page both set the master page to the Administration master page, and they set the theme different to the Customer.Page class too. These are set in the preinit event.
I have a user control called LinkList, of which there are 2 instances in the Administration master page. These are both referenced in the Administration.Page and Administration.Validation.Page classes, although they are created in the init event of the master
page. They are both private, but public readonly properties have been used to get them from the masterpage. They are only ever referenced in the page load event of Administration.Page and Administration.Validation.Page, and in several pages which inherit from
these classes. The only elements they contain are panels, hyperlinks (not server side), link buttons and labels.
Today, for some reason, after uploading the site to the server, they have been acting a bit odd. We can login fine after uploading the DLL, but if we leave it for so long these variables (and ONLY these variables, as far as I can tell) have been throwing
"object reference not set to an instance of an object" errors. The stacktrace has helped me to find out where it is occurring, but I have no idea why it is suddenly doing this. We have to reupload the DLL to be able to see them again. Does anyone have any
ideas about what is causing this?? If anyone is confused about anything then please say so and I will try to clarify anything as clearly as possible.
Thanks in advance.
PS If this is the wrong forum, I apologise and could someone kindly move this somewhere more relevant?
Mar 22, 2010 01:03 AM|sreejukg|LINK
It seems you have some problem with the application. Make sure there is no infinite loops. Also make sure you are disposing the objects. It seems your application pool is affected by the application. Also make sure the .net version for the application pool
is set correctly.
Whenever you upload the dll file, the application pool will be recycled. That might be the reason the error is cleared. If you have access to application pool, next time when the application is stuck recycle the application pool and try browsing the same.
If the problem is recurring in say every x hour, you can tell the application pool to recycle itself after every x-1 hour. But this a temporary solution only.
Mar 22, 2010 03:56 AM|jasminder.33|LINK
It looks like the values are getting losted after sometime. Try and check for Session Time Out problem. May be session expires and values are losted
Mar 22, 2010 07:52 AM|clarkeyb0y1987|LINK
Hmm I think I may have solved it, but I am not sure why it is loading in the first place. I found a try catch statement in the admin masterpage. In it there is a variable called ItemForm which uses the AjaxControlToolkit.dll (no other classes use this yet).
This form is used for viewing and editing items - it has states such as View, Edit, SubItems (so you can view or edit the items which appear within an item) and Closed (it doesnt appear). Also in the try catch statement the LinkList variables are set - after
it tries to create an instance of ItemForm, which fails.
Anyway my point is that I was catching the error and doing nothing with it, so my attention wasnt being drawn to it in the first place. I put a Response.Write line in there to write the exception message and stacktrace to the page - this is what I got:
"Could not load file or assembly 'AjaxControlToolkit, Version=3.0.30930.28736, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e' or one of its dependencies. Access is denied.
at ItemForm..ctor() at Administration1.Page_Init(Object sender, EventArgs e)"
Basically the ItemForm has a couple of upload fields to upload images to the server to associate with a particular item. This requires an impersonate tag in the Web.config file. I cant find any other simple way to impersonate. This is what is causing the
error, I think - the user being impersonated has access to the images folder, so while the page does work (for about 10 minutes after uploading the dll) I can upload images, but does not have access to the bin folder.
I just have no idea why it is occurring, when it doesnt occur to start with..
Anyone have any ideas on this?
Edit: Think I may have solved it - its back up and running anyway, without reuploading the dll. I am not too happy with the solution though - I had to give the impersonated user full control for the entire site..