• About Us
  • Blog
  • Basket
  • Account
  • Sign In
  •  

Forums

PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 24 Mar 2020 11:36 AM by  Joseph Dix
Content-Type set to application/xhtml xml for IE 11
 6 Replies
Sort:
You are not authorized to post a reply.
Author Messages

Don Adams



New Member


Posts:3
New Member


--
06 Mar 2020 03:33 PM
    We recently upgraded to v3.2.22.2 from 2.1.4.10. When requesting a .Net aspx page in IE 11, the Content-Type is set to application/xhtml+xml rather than text/html. This same page request works fine in Chrome, Firefox, and Edge. The only thing that has changed was the upgrade to v3.2.22.2.

    We are using the 51Degrees-LiteV3.2.dat data file. In the config file, the only sections that are enabled are the log and detection sections. The redirect and imageOptimisation sections are commented out.

    Is the 51Degrees.mobi library supposed to modify the response?

    Any help would be greatly appreciated.

    Thanks,

    Don Adams
    0

    Joseph Dix



    New Member


    Posts:32
    New Member


    --
    10 Mar 2020 10:27 AM
    Hi Don,

    There's nothing in the 51Degrees.mobi library which will modify the content type, that should be handled by ASP.NET.

    Can you try with one of the included example web applications?

    Either:
    https://github.com/51Degrees/dotNET...amples/MVC
    https://github.com/51Degrees/dotNET...Web%20Site


    I have tested these and can confirm that they return text/html in Internet Explorer 11.

    Regards,
    Joseph
    0

    Don Adams



    New Member


    Posts:3
    New Member


    --
    10 Mar 2020 09:26 PM
    Hi Joseph,

    I tried running the web application included with the zip file, the Detector Web Site, but I got an exception. Hopefully, you've seen this before and can give me some advice as to how to get it resolved:

    Execution permission cannot be acquired.

    Stack Trace:

    [PolicyException: Execution permission cannot be acquired.]
    System.Security.CodeAccessSecurityEngine.TryResolveGrantSet(Evidence evidence, PermissionSet& grantSet) +14079583
    System.Security.CodeAccessSecurityEngine.ResolveGrantSet(Evidence evidence, Int32& specialFlags, Boolean checkExecutionPermission) +60

    [FileLoadException: Could not load file or assembly 'Microsoft.VisualStudio.Web.PageInspector.Runtime, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. PolicyException thrown. (Exception from HRESULT: 0x80131416)]
    System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
    System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +232
    System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark) +176
    System.Reflection.Assembly.LoadFrom(String assemblyFile) +53
    Microsoft.VisualStudio.Web.PageInspector.Runtime.Loader.RuntimeLoader.GetRuntimeAssemblyFromSetupConfiguration(Assembly& runtime) +27
    Microsoft.VisualStudio.Web.PageInspector.Runtime.Loader.RuntimeLoader.GetRuntimeAssembly(Assembly& runtime) +39
    Microsoft.VisualStudio.Web.PageInspector.Runtime.Loader.RuntimeLoader.LoadRuntime() +26
    Microsoft.VisualStudio.Web.PageInspector.Runtime.Loader.RuntimeLoader.PreApplicationStart() +45

    [InvalidOperationException: The pre-application start initialization method PreApplicationStart on type Microsoft.VisualStudio.Web.PageInspector.Runtime.Loader.RuntimeLoader threw an exception with the following error message: Could not load file or assembly 'Microsoft.VisualStudio.Web.PageInspector.Runtime, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. PolicyException thrown. (Exception from HRESULT: 0x80131416).]
    System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +890
    System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +167
    System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +133
    System.Web.Compilation.BuildManager.ExecutePreAppStart() +178
    System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +746

    [HttpException (0x80004005): The pre-application start initialization method PreApplicationStart on type Microsoft.VisualStudio.Web.PageInspector.Runtime.Loader.RuntimeLoader threw an exception with the following error message: Could not load file or assembly 'Microsoft.VisualStudio.Web.PageInspector.Runtime, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. PolicyException thrown. (Exception from HRESULT: 0x80131416).]
    System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +552
    System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +122
    System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +737

    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4075.0

    I'm not sure if this is a file/folder permissions problem or with the trust level, but I've tried several things to try and resolve it to no avail.

    In regards to the original problem, I can readily duplicate it. To get it working again, all I have to do is copy in the old version of the dll and rename the 51Degress.config. To cause the error, I copy in the new dll and restore the name of the 51Degress.config file.

    Oddly, I have to close IE after copying in the new or old dll in order to see the effects. Clearing the cache, always requesting from the server, and CTRL F5 don't seem to have any effect. If the page was displaying fine and I copied in the new dll and renamed back the 51Degrees.config and refreshed the page, it displays fine again. It's only when I exit and reopen IE do I see the error. The same thing happens if I then restore the old dll.

    I hope you can help me with this.

    Thanks,

    Don
    0

    Joseph Dix



    New Member


    Posts:32
    New Member


    --
    11 Mar 2020 01:46 PM
    Hi Don,

    Yes this seem to be an issue in more recent versions of Visual Studio. The accepted response on this stack overflow post describes a workaround: https://stackoverflow.com/questions...tor-loader

    Regards,
    Joseph
    0

    Don Adams



    New Member


    Posts:3
    New Member


    --
    11 Mar 2020 04:26 PM
    Yes, I saw that post but that has to do with the Loader, not the Runtime, and for similar posts it seems to refer to a file not found error, not a permissions error.

    I did a google search for "enabling full trust asp.net" and found the following Microsoft article:
    https://docs.microsoft.com/en-us/pr...v%3Dws.11)

    So, I went into IIS and opened the .Net Trust Levels panel for the website and changed the trust from Medium to Full. As soon as I did that I was able to load the Detector Web Site pages without any problems in both Chrome and IE. I suspect I could have done this manually by changing the trust level setting in the web.config from Medium to Full. I don't think any other settings in web.config were changed but I haven't done a file compare to be sure.

    I also had to copy in the data file that I was using since the one in the Detector Web Site folder seems to be a stub version, and I'm using the lite version.

    So, the 51Degrees library does work with IE, but it is still odd that our software breaks when I replace the old library with the new one. That is a mystery that still needs to be solved.

    Thanks for your help,

    Don
    0

    Don Adams



    New Member


    Posts:3
    New Member


    --
    20 Mar 2020 09:08 PM
    I found the cause of the problem with our software. We had a very old mobile.browser file in the App_Browsers\Devices folder. In case I didn't mention it before, our website uses Web Forms. We got the mobile.browser file from http://mdbf.codeplex.com, which is no longer supported.

    When I copied this file to the 51Degrees .Net test website, the DONET properties page had a divide by zero exception.

    I found a browser file on the internet for IE11 and it worked fine by itself, but I was unable to add it to the existing mobile.browser file without getting a configuration error. I didn't spend a lot of time trying to get it to work since there's no need for both the mobile.browser file and the 51Degrees library, so I just deleted the mobile.browser file and our site started working again.

    Hopefully, this information will help someone else who has the same problem.
    0

    Joseph Dix



    New Member


    Posts:32
    New Member


    --
    24 Mar 2020 11:36 AM
    Hi Don,

    Thanks for posting the resolution, glad you were able to resolve this.

    If you have any further issues then don't hesitate to contact us again.

    Thanks,
    Joe
    0
    You are not authorized to post a reply.