3

I am experiencing a very strange issue. I have developped an application locally and everything works file. But on the production server i have several problems. The most annoying is the Navigation Menu that changes from horizontal to vertical after login.

site.Master

<asp:Menu ID="NavigationMenu" 
          runat="server" 
          cssclass="menu" 
          EnableViewState="false" 
          IncludeStyleBlock="false" 
          Orientation="Horizontal" 
          StaticDisplayLevels="1" 
          staticsubmenuindent="10" 
          target="_blank" 
          MaximumDynamicDisplayLevels="1" 
          Enabled="False" 
          Visible="False"> 

Site.css

/* TAB MENU   
----------------------------------------------------------*/

div.hideSkiplink
{
    background-color:#3a4f63;
    width:20%;
    z-index:9999;
}

div.menu
{
    padding: 4px 0px 4px 8px;
      z-index:9999;
}

div.menu ul
{
    list-style: none;
    margin: 0px;
    padding: 0px;
    width: 20%;
    z-index:9999;
    }

div.menu ul li a, div.menu ul li a:visited
{
    background-color: #465c71;
    border: 1px #4e667d solid;
    color: #dde4ec;
    display: block;
    line-height: 1.35em;
    padding: 4px 20px;
    text-decoration: none;
    white-space: nowrap;
      z-index:9999;
   }

div.menu ul li a:hover
{
    background-color: #bfcbd6;
    color: #465c71;
    text-decoration: none;
      z-index:9999;
   }

div.menu ul li a:active
{
    background-color: #465c71;
    color: #cfdbe6;
    text-decoration: none;
      z-index:9999;
   }

The css i use is the default.

I searched the net but no solution is proposed. Is it a server issue?Is it my code?

There is this thread with the exact problem. http://forums.asp.net/t/1762140.aspx/1?Odd+menu+problem+after+deployment , which doesnt propose a solution for the problem

Thanks

5
  • The thread you've linked does propose a solution - check that javaScript isn't being blocked by your browser. Failing that, what else does logging in do? Switch you to https? if so, are your CSS/js files still being served via http? Commented Feb 7, 2012 at 11:25
  • The problem remains for me, can you point me the solution in the thread, i am not very experienced. I did everything i understood. JavaScript is not blocked also. Commented Feb 7, 2012 at 11:32
  • The last post shows a solution - The OP was using the local browser on the server which had restrictive security settings (due to being Server 2008R2). What browser are you using to test - does it happen in all browsers? what OS is on the production/dev environments? If you open FireBug/similar, can you see any javascript errors/pages that aren't loading in the net tab? Commented Feb 7, 2012 at 13:13
  • Using firebug i found that the deployed version of my app has some differences. For the navigation menu locally the code is <div id="NavigationMenu" class="menu" style="float: left;">.The style attribute is added automatically. But on the deployed version it is not. Must i add the differences to the deployed version? Commented Feb 7, 2012 at 16:39
  • Moving m,y comments into an answer... Commented Feb 7, 2012 at 16:49

1 Answer 1

2

In all likelihood, the javascript which adds the class is not running on the page

There could be a number of reasons

  • It wasn't deployed properly.
  • The path is incorrect on the live server (are you in a different directory layout - eg /JavaScript/ instead of /myapp/JavaScript/?
  • NoScript or another addon is blocking javascript (browser-specific)
  • Something in the JS breaks on live and prevents execution before it gets to the relevant code

To track the problem down - Go to the net tab in firefbug and look at the javascript - does it all load with an HTTP 200 (Ok) ? Any 404/500s?

Try disabling all addons in your browser / use different browsers - same problem?

Open up the Script tab in firebug or the JavaScript console (CTRL Shift K in Firefox)

Reload your page and see if any errors/warnings appear.

Edit your answer with the results of the above and we'll see what we can do.

EDIT:

With regards to the 403/Forbidden - WebResource.axd is where the .Net Control-specific JS lives so this is almost certainly your problem. To make it more fun, .axd's aren't usually real files - they're HTTP handling extensions - see here and here for more information. Check your web.config - did the appropriate handlers get set in Live? It should be something like...

<add path="WebResource.axd"
         verb="GET"
         type="System.Web.Handlers.AssemblyResourceLoader"
         validate="True" />

If you've got an entry like that, can you edit your question to include it exactly? If not, try adding it

Possible fix here

Does the live server have the same version of the framework/controls installed as your development machine - Make sure it has!

Another thing to be aware of is that if you manually deploy a website, the files are usually owned by you, not the webserver - This can sometimes mean the webserver can't read the website to serve it. I doubt that's the problem here but it's something to be aware of in future. (To check, the website user is specified on the application pool for the site in IIS Manager).

Sign up to request clarification or add additional context in comments.

11 Comments

and use ctrl-F5 to reload in case you have cached version of js file.
It is indeed fantastic. Chrome has almost identical functionality built-in (Press F12) - and @dotjoe there's an option on the Net tab dropdown to disable the browsers cache while Firebug is open - Personally, I leave it on all the time.
You will say i'm a total noob but Firebug is awesome... Checking the net tab my default page loads with an http 200. My site.css with a 304 Modified and then it tries to GET Webresource.axd and it cannot. It gets a 403 forbidden (2 times). To answer your other questions, i deployed the site by just uploading all the files (xcopy or publish website from visual studio didnt work). I dont know about the correct path on the live server.No addons are blocking javascript
the site.css is http 200 always. The problem seems to be the webresource.Is this a server-side problem?
You can test the CSS is fine by adding the missing class using firebug after the page is rendered. It looks like the server isn't serving the javascript used by the .Net controls due to a permissions error.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.