Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# ASP.NET AuthenticationModule在url中使用令牌_C#_Asp.net_Iis_Webforms_Forms Authentication - Fatal编程技术网

C# ASP.NET AuthenticationModule在url中使用令牌

C# ASP.NET AuthenticationModule在url中使用令牌,c#,asp.net,iis,webforms,forms-authentication,C#,Asp.net,Iis,Webforms,Forms Authentication,我创建了一个HttpModule并附加了一个AuthenticateRequest处理程序来检查querystring中是否存在令牌。在那里,我从querystring中删除令牌,并重定向到不带令牌的所需页面,开始新的请求生命周期()并正常使用cookie构建会话 例如: 用户请求:example.com/example?令牌=12312kaasd12asd21ko323 AuthenticateRequest处理程序对用户进行身份验证并重定向到example.com/example 代码:

我创建了一个HttpModule并附加了一个AuthenticateRequest处理程序来检查querystring中是否存在令牌。在那里,我从querystring中删除令牌,并重定向到不带令牌的所需页面,开始新的请求生命周期()并正常使用cookie构建会话

例如:

  • 用户请求:
    example.com/example?令牌=12312kaasd12asd21ko323

  • AuthenticateRequest处理程序对用户进行身份验证并重定向到
    example.com/example

代码:

这是可行的,但是
AuthenticateRequest
为我的页面使用的所有文件夹、css、图像等触发

我想检查uri是否每一页只有一个令牌参数

我不能在
AuthenticateRequest
之后使用事件,因为在此之后,
FormsAuthentication
将覆盖uri重定向到登录

example.com/login.aspx?ReturnUrl=example&token=12312kaasd12asd21ko323
我想在请求和表单身份验证之间创建一个模块

我可以在BasePage中的FormsAuthentication之后获得重定向URL,并重定向到请求的页面,但这是我试图避免的解决方法

是否可以使用此行为创建该模块?我怎么做

我正在使用网络表单

谢谢

example.com/login.aspx?ReturnUrl=example&token=12312kaasd12asd21ko323