Mvc application being redirected to login page when accessing third party dll function

我的未来我决定 提交于 2019-12-11 14:47:13

问题


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:

  1. Right Click on your project
  2. Select 'Add Deployable Dependencies ...'
  3. Select Razor and MVC parameters
  4. Build Deployment Package
  5. 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:

  1. Expand the projects references.
  2. Right click the reference in question.
  3. Choose properties.
  4. Change 'Copy Local' to 'True'.
  5. Rebuild and publish project.
  6. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!