Random Redirect problem

  • Thread starter Thread starter Valeri Hristov via .NET 247
  • Start date Start date
V

Valeri Hristov via .NET 247

I have a problem with a ASP.NET web site. I?m using Windows2000Server SP4, .NET Framework 1.1. The problem is that sometimes(relatively seldom) when browsing the Administration Console(see below) a redirect (unwanted and unexpected) is made to thePublic Site to a random page. Often (almost in every of thecases) the redirect is to a page of the UserPart of thePublicSite with a User logged in! I?m almost sure that the Userwas browsing the site in that moment. The redirect is made notonly from one Admin page.
The site is made around a CMS. Every page has base template,which has several placeholders. In every placeholder anUserControl can be put. The user controls are the elements ofthe pages ? Body, Navigation, Message board etc. Every page hasseveral records in the database holding the position and thecontent of the UserControls.
The site is divided in two parts ? Public Site and AdministrationConsole. The admin console contains the controls necessary toconfigure the public part.
The loading of the Public pages is done by a request to thedatabase. Every page has its own unique PageId which determineswhat to put on it. For example: Page = 5 has in placeholder 1 ?TopNavigation.ascx, placeholder 2 ? BreadCrumbs.ascx,placeholder 3 ? SideNavigation.ascx, placeholder 4 ? PageBody,placeholder 5 ? empty, placeholder 6 ? news.
The PublicSite has a part for the users, which can be read bylogging into the system (Forms authentication). There some ofthe user information (name, email, password etc) can be changedand there is also access to some private areas (the Forum forexample). After authentication an object containing some userinformation is created in the Session.
The Administration Console is also a CMS, but much more staticthan the Public Site. The public site has its own public.aspx,and the Administration Console its own console.aspx, but theyare in the same application.
 
check your use of static (shared or modules in vb) variables.

-- bruce (sqlwork.com)


I have a problem with a ASP.NET web site. I?m using Windows2000 Server SP4,
..NET Framework 1.1. The problem is that sometimes (relatively seldom) when
browsing the Administration Console (see below) a redirect (unwanted and
unexpected) is made to the Public Site to a random page. Often (almost in
every of the cases) the redirect is to a page of the UserPart of the
PublicSite with a User logged in! I?m almost sure that the User was browsing
the site in that moment. The redirect is made not only from one Admin page.
The site is made around a CMS. Every page has base template, which has
several placeholders. In every placeholder an UserControl can be put. The
user controls are the elements of the pages ? Body, Navigation, Message
board etc. Every page has several records in the database holding the
position and the content of the UserControls.
The site is divided in two parts ? Public Site and Administration Console.
The admin console contains the controls necessary to configure the public
part.
The loading of the Public pages is done by a request to the database. Every
page has its own unique PageId which determines what to put on it. For
example: Page = 5 has in placeholder 1 ? TopNavigation.ascx, placeholder 2 ?
BreadCrumbs.ascx, placeholder 3 ? SideNavigation.ascx, placeholder 4 ?
PageBody, placeholder 5 ? empty, placeholder 6 ? news.
The PublicSite has a part for the users, which can be read by logging into
the system (Forms authentication). There some of the user information (name,
email, password etc) can be changed and there is also access to some private
areas (the Forum for example). After authentication an object containing
some user information is created in the Session.
The Administration Console is also a CMS, but much more static than the
Public Site. The public site has its own public.aspx, and the Administration
Console its own console.aspx, but they are in the same application.
 
Hello Bruce,
I tried to use as less as possible static variables, but there are
lots of static methods.
Actually the problem occurs in too many different locations and I
think the resolution may be in the configuration of the IIS or the
Framework. The site is large - 100k+ lines of code.
 
Valeri Hristov said:
Hello Bruce,
I tried to use as less as possible static variables, but there are
lots of static methods.
Actually the problem occurs in too many different locations and I
think the resolution may be in the configuration of the IIS or the
Framework. The site is large - 100k+ lines of code.

Valeri, you should not use writable static variables at all. At the very
least, you need to synchronize access to them. If you do not do this, you
_will_ see random errors which are very difficult to fix.
 
As you see in the code below the static variable is initialized only
once. It is one of the few static variables (I ran a search thru the
project) and all have accessors and are read-only.
I'm concerned about the lots of static methods used to access the
database.
 
Valeri Hristov said:
As you see in the code below the static variable is initialized only
once. It is one of the few static variables (I ran a search thru the
project) and all have accessors and are read-only.
I'm concerned about the lots of static methods used to access the
database.

Static methods shouldn't be a problem. The problem would be static variables
being written from multiple threads. Another related issue would be static
variables being written by one user and then read by another.
 
Back
Top