Pyromancer
Pyromancer

Reputation: 317

Site using code behind files from the wrong directory?

What settings in ASP.NET determine where (as in which directorie(s)) a website will look for its code-behind files?

I have two versions of an asp.net c# website, Live and Dev.

Live site: www.example.com with the pages and code in c:\dev\websites\examplecom_new

Dev site: d3.example.com with the pages and code in c:\dev\websites\examplecom-d2

There are historic reasons why the live site's directory ends in _new and why the dev site has d3 as its hostname and -d2 on its directory name, but they work and until now we've had no issues, developing things on d3 for subsequent release to live.

I recently refreshed the dev site to be an exact copy of the live one (I usually do this before starting a new round of work), and started on some development work. However, when I tried to run the code via the website, even though the browser was showing the Dev URL, d3.example.com, the error message referenced a code file from the live site's web directory, c:\dev\examplecom_new, not the development version c:\dev\examplecom-d2.

I've gone through the code in detail to ensure there are no hard-coded references to either the www site or the path to the live site directory, and as far as I can tell there are none. The code files in all cases are referred to in the .aspx files as local links, for example:

<%@ Page Language="C#" MasterPageFile="~/ExampleCom.master" AutoEventWireup="true"
    CodeFile="Checkout.aspx.cs" Inherits="Checkout" Title="Untitled Page" %>

Yeah, I know "Untitled Page" isn't the most useful title in the world. :)

I've gone through web.config, had a look in app_code\general.cs, and checked all the tabs on the Properties element in IIS, but I can't find anything that could be telling the site to use the .cs files from the live dir instead of the dev one.

I tried restoring the previous (pre-refresh) version of the Dev site (I always back them up before replacing, just in case), just in case there was a config change I wasn't aware of, but the old version exhibits exactly the same problem, the Checkout page calls code from live, not dev, even though its URL is showing the dev verson in the browser.

Needless to say this is something of a showstopper, the error that's happening appears to be due to a session mis-match between live and dev, but I have no idea why the dev site is calling code from the live site instead of code in its own directory. Any pointers to what might be wrong would be appreciated. I've tried both Googling for "asp.net code behind files called from wrong directory" and related searches, and searching Stack Overflow for the same types of thing, but not seen anything related. We're not using pre-compiled binaries, just standard .aspx pages and .aspx.cs C# code files.

At first I'd assumed there must have been a hardcoded redirect kicking things over from dev to live, however I can see no trace of one and the browser address bar still shows d3.example.com/Checkout.aspx when I'd have expected a redirect to live to change it to the www version.

The webserver is IIS 6 and we're running ASP 2.

Upvotes: 2

Views: 1204

Answers (1)

Kenan Kocaerkek
Kenan Kocaerkek

Reputation: 319

Run "iisreset" command from command line and then clear temporary folder. All applications will be recompiled after that.

Upvotes: 1

Related Questions