I am hosting a MVC3 application in IIS7. The aplication got hosted but ajax post is not working in the application.
Could Anyone help on this?
Thanks in advance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You have hardcoded the urls in your javascript, haven’t you?
For example you wrote:
instead of using url helpers:
Also you probably have hardcoded script locations:
instead of using url helpers:
Now go ahead through your code and replace all urls that you have hardcoded with ones generated with helpers.
The reason your code doesn’t work when you host it in IIS is because you host your application in a virtual directory. So the correct path is no longer
/Home/Indexbut/SomeAppName/Home/Index. The best way top ensure that your application will work in all environments no matter where it is hosted is to always use url helpers.