rito1
asked on
Get Current File and QueryString
Hi All,
Is there a piece of C# code that will return the file and any strings appended to the file from a URL?
e.g. http://www.mydomain.com/page.aspx?account=220&type=334
In my page.aspx code, I need to obtain this part of the URL:
page.aspx?account=220&type =334
Many Thanks,
Rit
Is there a piece of C# code that will return the file and any strings appended to the file from a URL?
e.g. http://www.mydomain.com/page.aspx?account=220&type=334
In my page.aspx code, I need to obtain this part of the URL:
page.aspx?account=220&type
Many Thanks,
Rit
String str_main = " http://www.mydomain.com/page.aspx?account=220&type=334"
Dim str_result as string
str_reult
string strMain = " http://www.mydomain.com/page.aspx?account=220&type=334";
int len = strMain.Length;
string ResultString = "";
ResultString = strMain.SubString(strMain. IndexOf("? ")+1 , len)
Dim str_result as string
str_reult
string strMain = " http://www.mydomain.com/page.aspx?account=220&type=334";
int len = strMain.Length;
string ResultString = "";
ResultString = strMain.SubString(strMain.
Please disregard my last thread
here is the currect
string strMain = " http://www.mydomain.com/page.aspx?account=220&type=334";
int len = strMain.Length;
string ResultString = "";
ResultString = strMain.SubString(strMain. IndexOf("? ")+1 , len) ;
here is the currect
string strMain = " http://www.mydomain.com/page.aspx?account=220&type=334";
int len = strMain.Length;
string ResultString = "";
ResultString = strMain.SubString(strMain.
I guess you need to apply to any url (detecting your current url), so you need:
String url = Request.Url.ToString().Rep lace("http://www.", "");
Hope that helps.
String url = Request.Url.ToString().Rep
Hope that helps.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
try this
url.SubString(url.LastInde xOf("/")+1 )
url.SubString(url.LastInde
a fix
url.Substring(url.LastInde xOf("/")+1 )
url.Substring(url.LastInde
ASKER
Wow, I go to lunch and come back to many answers.. thank you very much.
I am just working through them now and will come back to you.
Kind Regards,
Rit
I am just working through them now and will come back to you.
Kind Regards,
Rit
ASKER
Perfect, thanks,
Rit
Rit
Open in new window