问题
I'm using a third party dll in my MVC3 application. When using the dll at localhost(my PC) it works great. But when I upload it to web server(shared hosting) I encounter a problem. The application works fine when not using the functions in the dll. But when any function of the third party dll is called upon the page is redirected to the login page.
NOTE: I'm using Forms Authentication.
I had set folder properties and set <identity impersonate="true"> for the application to access files and folder in the web server.
回答1:
Your deployment package should contain necessary files for asp.net MVC. follow this steps in Visual Studio:
- Right Click on your project
- Select 'Add Deployable Dependencies ...'
- Select Razor and MVC parameters
- Build Deployment Package
- Start Publishing
by doing this steps we'll ensure that MVC application works confidently even if host/server doesn't support MVC or Razor.
回答2:
I found that doing the following fixed the problem:
- Expand the projects references.
- Right click the reference in question.
- Choose properties.
- Change 'Copy Local' to 'True'.
- Rebuild and publish project.
- Test and do the same to any other required references if need be.
来源:https://stackoverflow.com/questions/17842850/mvc-application-being-redirected-to-login-page-when-accessing-third-party-dll-fu