本文介绍了对于iisnode拦截请求,HTTP模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个子目录使用iisnode的.NET应用程序(实际上是一把umbraco)一个应用程序的NodeJS运行。

I have a nodejs app running using iisnode in a sub directory for a .net application (umbraco actually).

在.NET应用程序使用窗体身份验证,我想使用相同的机制为.NET应用程序,以确保应用程序iisnode

The .net application is using forms authentication and I want to secure the iisnode application using the same mechanism as the .net application.

我试着注册模块与iisnode应用程序,但它并不甚至似乎触发事件处理程序。是否有可能做到这一点?

I've tried registering modules with the iisnode app but it doesn't even seem to fire the event handlers. Is it possible to do this?

推荐答案

看来,创建一个HttpModule拦截请求的NodeJS是不可能的。但是,我没有找到一个办法让我在以后的认证信息。

It seems that creating an HttpModule to intercept nodejs requests is impossible. However, I did find a way to get the authentication information I was after.

我在创建的NodeJS一些中间件(如pressjs)应用程序,从请求(包括饼干)拾取头,并使用这些相同的头文件,以在asp.net应用程序专门创建的URL的请求。

I created some middleware in my nodejs (expressjs) app that picks up the headers from the request (including the cookies) and make a request to a specially created url on the asp.net application using those same headers.

此网址直接返回cookie中指定的用户的用户信息(如果cookie是present)。如果我找回了一些资料,然后我知道在用户登录,没有信息化手段,他们还没有登录,我重定向到一把umbraco登录页面。

This url simply returns the user info for the user specified in the cookie (if the cookie is present). If I get back some information then I know the user is logged in. No information means they are not logged in and I redirect to the umbraco login page.

这篇关于对于iisnode拦截请求,HTTP模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 13:39