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

Chris
  • 6,272
  • 9
  • 35
  • 57
joy84
  • 43
  • 1
  • 4
  • 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? – Basic Feb 07 '12 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. – joy84 Feb 07 '12 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? – Basic Feb 07 '12 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 – joy84 Feb 07 '12 at 16:39
  • Moving m,y comments into an answer... – Basic Feb 07 '12 at 16:49

1 Answers1

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).

Community
  • 1
  • 1
Basic
  • 26,321
  • 24
  • 115
  • 201
  • and use ctrl-F5 to reload in case you have cached version of js file. – dotjoe Feb 07 '12 at 16:59
  • 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. – Basic Feb 07 '12 at 17:16
  • 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 – joy84 Feb 07 '12 at 17:18
  • the site.css is http 200 always. The problem seems to be the webresource.Is this a server-side problem? – joy84 Feb 07 '12 at 17:29
  • 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. – Basic Feb 07 '12 at 17:31
  • Edited again to add a link "Possible fix here" – Basic Feb 07 '12 at 17:33
  • Sorry for the late response. I am trying to find a solution with the webadmin. I added the lines in web.config but nothing has happened. It works perfect on my local iis and his local iis.Is it possible that the iis of the machine that the app is deployed, needs certain settings. I found an article that says something about compression on iis. – joy84 Feb 08 '12 at 16:13
  • No worries - Yes, it's quite possibly server-specific - have a closer look at the links in my edited answer - they point out where the machine (not app) config lives. Specifically, look at this answer: http://stackoverflow.com/a/4044525/156755 – Basic Feb 08 '12 at 17:24
  • A detailed explanation of how configs are applied is available here: http://technet.microsoft.com/en-us/library/cc754617(WS.10).aspx – Basic Feb 08 '12 at 17:26
  • My webadmin is struggling with my problems. It was a server-side issue. @Basic you really helped him with everything.Thanks very very much. – joy84 Feb 09 '12 at 16:23
  • You're welcome. If we've managed to track down the problem, please accept my answer. If not, let me know what else you need. Thanks and see you around SO – Basic Feb 09 '12 at 16:24