I was working on an application in asp.net and on localhost was working fine. When deployed on IIS server the url in ajax post and print are not working. What I have is
I was working on an application in asp.net and on localhost was working fine. When deployed on IIS server the url in ajax post and print are not working. What I have is
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Aman GuptaPosted Aug 22, 2024, 5:17 PM
Hi Marius,
When your ASP.NET application works fine on localhost but has issues after deployment on IIS, especially with AJAX requests and printing, it often points to issues related to URL paths, server configuration, or file permissions. Let's go through possible solutions for both problems.
1. AJAX Post URL Issue:
The AJAX request URL might be incorrect after deployment because of the difference in virtual directories or application paths.
Solution:
Use Relative or Absolute URLs:
Modify the url property in your AJAX call to use a relative URL based on the application's root.
This ensures the correct path is used regardless of where the application is hosted.
Check IIS Application Configuration:
Ensure your application is set up as an "Application" in IIS, not just a directory. This can affect how URLs are resolved.
Web.config:
Ensure that your web.config allows for POST requests and that there's no URL rewriting or routing issues that might block or change your AJAX request paths.
2. Print Functionality Issue:
The problem with the print functionality might be related to incorrect paths to CSS files or JavaScript files when deployed.
Solution:
Use Correct Paths for External Resources:
Use the ResolveUrl method or similar techniques to ensure paths to your stylesheets are correct.
Browser Security Settings: Ensure that the server allows pop-ups and that the print functionality is not being blocked by security settings.
IIS MIME Types: Ensure that the necessary MIME types for your CSS and JS files are correctly configured in IIS. If the server does not serve these files, the print functionality may not work as expected.
Marius VasilePosted Aug 22, 2024, 4:48 PM
So, there as no issues with the path but loading the jquery in master page. I had to use
<%= ResolveUrl("path-to-file") %>