Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove querystring part from Request.UrlReferrer.AbsoluteUri in C#

I want to remove the Querystring part from my Request.UrlReferrer.AbsoluteUri before the Redirect in C#.

For example, if you have got your

Request.UrlReferrer.AbsoluteUri = "http://localhost:8080/english/index_2011.aspx?logout=true"

Now I want to

Response.Redirect(Request.UrlReferrer.AbsoluteUri) without QueryString part (?logout=true")

Please suggest using C#

like image 287
Manoj Singh Avatar asked Feb 03 '11 09:02

Manoj Singh


1 Answers

use Request.UrlReferrer.AbsoluteUri.ToString().Split('?')[0]

This should do the trick for you.

like image 122
Sachin Shanbhag Avatar answered Sep 21 '22 01:09

Sachin Shanbhag