Reputation: 2019
I have some code,
if (Request.Headers["User-Agent"] == "Mozilla/4.0 (compatible; MSIE 4.01; Windows NT; MS Search 6.0 Robot)")
{
this.Response.Redirect("/_windows/default.aspx?" + qp.ToString());
}
else if(Request.Headers["GET"].Contains("SignOut.aspx") ) {
this.Response.Redirect("/_layouts/signout.aspx");
}
else
{
this.Response.Redirect("/_trust/default.aspx?trust=ADFS%20DEV&" + qp.ToString());
}
The problem is that my else if
does not work because Request.Headers
can not read the "GET", per Microsoft http://msdn.microsoft.com/. I want to know when the GET url contains SignOut.aspx, is there a way for me to read that part of the header?
Upvotes: 0
Views: 3621
Reputation: 102
Looks like you're looking for HttpRequest.Url, which you can access from the Request object via Request.Url:
...
else if (Request.Url.AbsoluteUri.Contains("SignOut.aspx"))
{
//Whatever
}
...
Furthermore, you might want to look more into what the framework offers for handing requests - you're doing things the hard way and re-inventing the wheel. Consider using
Request.UserAgent
instead of
Request.Headers["User-Agent"]
Upvotes: 1