Reputation: 7374
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.
Upvotes: 1
Views: 997
Reputation: 7374
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);
Upvotes: 2
Reputation: 81847
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.
Upvotes: 3