FormaAuthentication.GetRedirectURL不返回绝对URL [英] FormaAuthentication.GetRedirectURL Does not return absolute URL

查看:80
本文介绍了FormaAuthentication.GetRedirectURL不返回绝对URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部,

我们在

多个网络服务器上有多个ASP.NET网络应用程序和设置(win2k,.netframework 1.1)。所有

Web应用程序都设置为使用Forms身份验证。

所有应用程序将被发送到同一个应用程序

以获得身份验证(认证标签和

machienkey标签都已正确设置)然后

假设,在获得认证后,重定向回原始网址。


我的问题是:FormsAuthentication.GetRedirectURL

方法总是返回一个相对url而不是

绝对值。即它比返回/folder/page.aspx而不是
http://from.site.com/folder/asp.aspx



有谁知道原因,还有什么(可能在

registry)我可以设置强制它返回绝对URL吗?


我知道我可以在global.asax中做一些解决方法。但是还有其他不错的方式吗?


感谢上百万的帮助!

Mariam

解决方案

我使用绝对网址登录不同的应用程序...


说您的身份验证应用程序位于
http:// localhost / secure /


你的应用程序是
http:// localhost / app1
http:// localhost / app2

两个应用程序的webconfig loginurl应指向
http://localhost/secure/login.aspx

我所做的是手动重定向...设置票证后......你可能会想要看看我对表格认证帖子的回复

返回的returnURL http://localhost/secure/login.aspx 是绝对的

和我不使用formsauthentication的重定向..而是...做一个手册

response.redirect如果我找到returnURL


hth


-

问候,


HD


" Mariam" ; < CH ******** @ yahoo.com>在留言中写道

news:07 **************************** @ phx.gbl ... < blockquote class =post_quotes>全部,
我们在多个Web服务器上有多个ASP.NET Web应用程序和设置(win2k,.netframework 1.1)。所有的
Web应用程序都设置为使用Forms身份验证。
所有应用程序将被发送到同一个应用程序
以获得身份验证(身份验证标记和
machienkey标记都包含已正确设置)然后
假设,在验证后重定向回原始URL。

我的问题是:FormsAuthentication.GetRedirectURL
方法总是返回一个相对url而不是绝对的url。即它返回/folder/page.aspx而不是 http:// from.site.com/folder/asp.aspx

有谁知道为什么,有什么(可能在
注册表中)我可以设置强制它返回绝对的URL?

我知道我可以在global.asax中做一些解决方法。但还有其他好方法吗?

感谢一百万人的帮助!
Mariam



戴夫,



在重定向之前,我通过

字符串获取重定向URL strURL = FormsAuthentication.GetRedicrectUrl(username,false);

然后我做

Response.Redirect(strURL);


是的。您的senario可以工作,因为不同的应用程序不同

同一台机器上的虚拟目录。相对URL将起作用(

是开发环境中我的应用程序的方式。它们工作得很好。)


您是否跟踪了returnUrl值?它有 http:// xxxx / 吗?我的

没有。


我的senario是这样的:

安全应用程序位于: http://secure.mycompany.com/

使用安全应用程序的应用程序请访问
http://app1.mycompany.com/ 。他们在两台不同的机器上。


现在我从app1,newpage.aspx请求一个页面,所以我被重定向到
http://secure.mycompany.com/ 。但问题中的ReturnURL

字符串显示newpage.aspx,而不是
http://app1.mycompany.com/newpage.aspx


你是怎么得到的 http://app1.mycompany.com 进入returnURL。


我看到一些帖子说在测试版中,ReturnURL是绝对的
。但是在发布版本中,它是相对的...


有什么建议吗?

***通过Developersdex发送 http://www.developersdex.com ***

不要只参加USENET ...获得奖励!


http://localhost/WebAdmin/Login.aspx...n%2fIndex.aspx


你可以看到它没有...我可能想尝试上传它和

看看它在两个不同的服务器上的行为

他们应该在两个不同的服务器上运行......给我半个小时...

必须做一个小改动...会尝试一下。


希望它能起作用。 ..我有一些史蒂文传递给我的网址...

lemme抓住他们....


#Forms认证跨越Appli阳离子
http ://msdn.microsoft.com/library/en...asp?frame = true


让我知道你是怎么过的......我会给一旦我完成就试一试

随着这个改变

-

问候,


HD


" Mariam Sheikholeslam" < CH ******** @ yahoo.com>在消息中写道

新闻:ew ************* @ TK2MSFTNGP11.phx.gbl ...

戴夫,

感谢您的回复。我也在进行手动重定向。

在重定向之前,我通过
字符串获取重定向URL strURL = FormsAuthentication.GetRedicrectUrl(用户名,false);
然后我做
Response.Redirect(strURL);

是的。您的senario可以工作,因为不同的应用程序在同一台机器上是不同的虚拟目录。相对URL将起作用(
是开发环境中的应用程序。它们完美地工作)。

您是否跟踪了returnUrl值?它有 http:// xxxx / 吗?我的
没有。

我的Senario是这样的:
安全应用程序位于: http://secure.mycompany.com/
使用安全应用程序的应用程序位于
http://app1.mycompany.com/ 。它们位于两台不同的机器上。

现在我从app1,newpage.aspx请求一个页面,所以我被重定向到
http://secure.mycompany.com/ 。但问题
字符串中的ReturnURL显示newpage.aspx,而不是
http://app1.mycompany.com/newpage.aspx

你是怎么得到的?a rel =nofollowhref =http://app1.mycompany。 comtarget =_ blank> http://app1.mycompany.com 进入returnURL。

我看到一些帖子说在测试版中,ReturnURL是
绝对。但是在发布版本中,它是相对的...

任何建议?

***通过Developersdex发送 http://www.developersdex.com ***
不要只是参加USENET ......获得奖励!



Hi, all,
We have mutiple ASP.NET web applications and setup on
mutiple web servers (win2k, .netframework 1.1). All the
web applications are setup to use Forms authentication.
All the applications will be sent to the same application
to get authenticated (the authentication tag and the
machienkey tag have all been setup properly) and then
supposely, redirect back to the originated URL after
getting authenticated.

My problem is: The FormsAuthentication.GetRedirectURL
method always returns a relative url rather than an
absolute one. I.e. it returns /folder/page.aspx rather
than http://from.site.com/folder/asp.aspx.

Does anyone know why and is there anything (maybe in the
registry) I can set to force it to return the absolute URL?

I know I can do some workaround in the global.asax. But is
there other nice way?

Thanks a million for the help!
Mariam

解决方案

i am using absolute url for login across different applications...

say your authentication app is under
http://localhost/secure/

your apps are
http://localhost/app1
http://localhost/app2
the webconfig for the two app''s loginurl should point to
http://localhost/secure/login.aspx
what i do is manual redirection... after setting the ticket... you might
want to have a look at my reply to forms authentication post
the returnURL passed to the http://localhost/secure/login.aspx is absolute
and i dont use redirect of formsauthentication.. instead... do a manual
response.redirect if i find returnURL

hth

--
Regards,

HD

"Mariam" <ch********@yahoo.com> wrote in message
news:07****************************@phx.gbl...

Hi, all,
We have mutiple ASP.NET web applications and setup on
mutiple web servers (win2k, .netframework 1.1). All the
web applications are setup to use Forms authentication.
All the applications will be sent to the same application
to get authenticated (the authentication tag and the
machienkey tag have all been setup properly) and then
supposely, redirect back to the originated URL after
getting authenticated.

My problem is: The FormsAuthentication.GetRedirectURL
method always returns a relative url rather than an
absolute one. I.e. it returns /folder/page.aspx rather
than http://from.site.com/folder/asp.aspx.

Does anyone know why and is there anything (maybe in the
registry) I can set to force it to return the absolute URL?

I know I can do some workaround in the global.asax. But is
there other nice way?

Thanks a million for the help!
Mariam



Hi, Dave,

Thanks for your response. I am doing manual redirect as well.

Before I redirect, I get the redirect URL through
string strURL = FormsAuthentication.GetRedicrectUrl(username,false );
Then I do
Response.Redirect(strURL);

Yes. Your senario works since different applications are different
virtual directories on the same machine. An relative URL will work (that
is how my apps in the dev enviroment. They work perfectly).

Did you trace the returnUrl value? does it have http://xxxx/ in it? Mine
does not have.

My senario is like this:
Secure application is at: http://secure.mycompany.com/
The application that using the secure application is at
http://app1.mycompany.com/. They are on two different machines.

Now I request a page from app1, newpage.aspx, so I was redirected to
http://secure.mycompany.com/ for lgoin. But the ReturnURL in the quesry
string shows newpage.aspx, rather than
http://app1.mycompany.com/newpage.aspx.

How did you get http://app1.mycompany.com into the returnURL.

I saw some posts say that in the beta version the ReturnURL was
absolute. But when in the release version, it is relative ...

Any suggestions?
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!


http://localhost/WebAdmin/Login.aspx...n%2fIndex.aspx

as you can see it does not... i would probably like to try and upload it and
see how it behaves on two different server
they are supposed to go on two different servers... give me half an hour...
have to make a small change... will try it out.

hopefully it should work... i have some urls that steven passed on to me...
lemme get hold of them....

#Forms Authentication Across Applications
http://msdn.microsoft.com/library/en...asp?frame=true

let me know how you get on... and i will give it a try as soon as i am done
with that change
--
Regards,

HD

"Mariam Sheikholeslam" <ch********@yahoo.com> wrote in message
news:ew*************@TK2MSFTNGP11.phx.gbl...

Hi, Dave,

Thanks for your response. I am doing manual redirect as well.

Before I redirect, I get the redirect URL through
string strURL = FormsAuthentication.GetRedicrectUrl(username,false );
Then I do
Response.Redirect(strURL);

Yes. Your senario works since different applications are different
virtual directories on the same machine. An relative URL will work (that
is how my apps in the dev enviroment. They work perfectly).

Did you trace the returnUrl value? does it have http://xxxx/ in it? Mine
does not have.

My senario is like this:
Secure application is at: http://secure.mycompany.com/
The application that using the secure application is at
http://app1.mycompany.com/. They are on two different machines.

Now I request a page from app1, newpage.aspx, so I was redirected to
http://secure.mycompany.com/ for lgoin. But the ReturnURL in the quesry
string shows newpage.aspx, rather than
http://app1.mycompany.com/newpage.aspx.

How did you get http://app1.mycompany.com into the returnURL.

I saw some posts say that in the beta version the ReturnURL was
absolute. But when in the release version, it is relative ...

Any suggestions?
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!



这篇关于FormaAuthentication.GetRedirectURL不返回绝对URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆