views:

36

answers:

2

Hi everyone!

I'm using asp.net with url rewrite.

Inside Page Load I have the following code:

OpenIdLogin1.ReturnToUrl = @"~/Login"

When I log in and return to calling page, I get the following error message:

Login failed: The openid.return_to parameter (http://localhost:12345/Login?dnoa.receiver=ctl00_phContent_ctl00_OpenIdLogin1&dnoa.UsePersistentCookie=Session&dnoa.userSuppliedIdentifier=https://www.google.com/accounts/o8/id) does not match the actual URL (http://localhost:12345/Templates/Pages/Login/Login.aspx?dnoa.receiver=ctl00_phContent_ctl00_OpenIdLogin1&dnoa.UsePersistentCookie=Session&dnoa.userSuppliedIdentifier=https://www.google.com/accounts/o8/id&openid.ns=http://specs.openid.net/auth/2.0)

How can I change actual url to virtual url?

Any help would be appreciated.

+1  A: 

In your call to GetResponse, pass in an HttpRequestInfo object that you initialize with the URL you want DotNetOpenAuth to see as the incoming URL.

Andrew Arnott
I did that but it still returns me to the same url.
šljaker
A: 

I solved the problem:

var openId = new OpenIdRelyingParty();
HttpContext httpContext = HttpContext.Current;

var headers = new WebHeaderCollection();
foreach (string header in httpContext.Request.Headers)
{
    headers.Add(header, httpContext.Request.Headers[header]);
}

string requestUrl = string.Format("http://localhost:12345/Login/{0}",
                                   httpContext.Request.Url.Query);

var requestInfo = new HttpRequestInfo(httpContext.Request.HttpMethod,
                                        new Uri(requestUrl),
                                        httpContext.Request.RawUrl, headers,
                                        httpContext.Request.InputStream);

var response = openId.GetResponse(requestInfo);
šljaker
So I see that that is exactly what I gave in my answer as what you should do. Why is it that you commented that it didn't work, and then posted your own answer that it did?
Andrew Arnott