0
  • Website: https://abc.xyz.com/emrsso

  • IIS Setup: Site > SHC > EMRSSO

  • Virtual Path: /EMRSSO

  • Default Document: SSOLogin.aspx

  • Physical path: D:\Renesan\SHCTest\EMRSSO

And also there is Scripts folder under EMRSSO e.g. D:\Renesan\SHCTest\EMRSSO\Scripts.

Then there is jquery-3.4.1.min.js under Scripts folder e.g. D:\Renesan\SHCTest\EMRSSO\Scripts\jquery-3.4.1.min.js

when I visit https://abc.xyz.com/emrsso, It is 404 error or jquery-3.4.1.min.js, on debugging I found in chrome dev tool path is showing as 'https://abc.xyz.com/Scripts/jquery-3.4.1.min.js' instead of 'https://abc.xyz.com/emrsso/Scripts/jquery-3.4.1.min.js'

when I visit https://abc.xyz.com/emrsso/SSOLogin.aspx, jquery-3.4.1.min.js is rendering successfully and on debugging in chrome dev tool path is showing as 'https://abc.xyz.com/emrsso/Scripts/jquery-3.4.1.min.js' which is fine.

When I debug my application through Visual Studio jquery-3.4.1.min.js is rendering successfully and working fine.

ASPX Code for jquery-3.4.1.min.js:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="SSOLogin.aspx.vb" Inherits="EHR_Web.SSOLogin" %>

<script src="https://global.oktacdn.com/okta-signin-widget/5.2.0/js/okta-sign-in.min.js" type="text/javascript"></script>
<link href="https://global.oktacdn.com/okta-signin-widget/5.2.0/css/okta-sign-in.min.css" type="text/css" rel="stylesheet" />
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>

I have gone through other question: Why IIS doesn't handle relative path the same way IIS Express does?

However I did not find any resolution. what can be wrong here?

James Z
  • 12,209
  • 10
  • 24
  • 44

1 Answers1

1

Try resolving your URL, this keeps the path consistent regardless of which folder a page/control is in.

<script src="<%=ResolveUrl("~/Scripts/jquery-1.4.1.min.js")%>" type="text/javascript"></script>

https://learn.microsoft.com/en-us/dotnet/api/system.web.ui.control.resolveurl?view=netframework-4.8.1

JustAnotherDev
  • 546
  • 2
  • 8