Reputation: 8088
I'm having an issue Redirecting to the same domain.
For example, the redirection takes place on ServerA.Domain.com/Folder/application.aspx. However, the program redirects me to ServerA/Folder/application.aspx.
The application works fine on this domain, but I'm forced to relogin.
What can I do to force the redirection to the same domain??
I am using asp.net 3.5
Added My Redirect looks as follows:
Response.Redirect("/Folder/application.aspx?");
Upvotes: 1
Views: 4139
Reputation: 322
ResolveClientUrl returns a relative path to the current url; ResolveUrl returns the absolute path. So ResolveUrl may work better in case it is called within a usercontrol under another folder:
Response.Redirect(this.ResolveUrl("~/Folder/application.aspx?"));
Upvotes: 0
Reputation: 7484
What if you just add the tilde (~) character and a call to ResolveClientUrl to the redirect?
Response.Redirect(this.ResolveClientUrl("~/Folder/application.aspx?"));
Does that take care of the problem?
Upvotes: 3
Reputation: 20004
It looks like your on a sub domain trying to redirect to a folder on the sub domain. I believe you need to use the fully qualified URL:
Response.Redirect("http://ServerA.Domain.com/Folder/application.aspx?");
What's happening is your sub domain is a folder on the main site, which your telling your app to redirect to. It doesn't know that you have a sub domain set up which accesses that folder by default.
Update:
Try using HttpContext.Current.Request.Url.xxxxx
and then appending to that. This way you can probably get your sub domain route and redirect in the format you want.
Upvotes: 0