Click here to Skip to main content
15,912,897 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello
I have a url for example( www.example.com/jsk/product_detail.aspx?icode=KUT101")

In this how to use index of or substring method that I find out string before = sign and after = sign
Posted
Updated 21-Jun-12 23:53pm
v2

Is Google broken at your place? MSDN has a nice example [^]for this.

C#
string text = "www.example.com/jsk/product_detail.aspx?icode=KUT101";
string[] words = text.Split('=');

string beforeEqualSign = words[0];
string afterEqualSign = words[1];



Btw, I guess that you need to read the query string. Read more about it http://msdn.microsoft.com/en-us/library/system.web.httprequest.querystring.aspx.
 
Share this answer
 
v2
Comments
Prasad_Kulkarni 22-Jun-12 6:02am    
Good suggestion and example too, my 5!
Manas Bhardwaj 22-Jun-12 6:09am    
thx!
vangapally Naveen Kumar 22-Jun-12 6:04am    
Good Suggestion
Manas Bhardwaj 22-Jun-12 6:09am    
thx!
Rakesh Tailor 22-Jun-12 6:08am    
thanks
If you need to find the value in the query string, you can always use:
C#
string strCode = Request.QueryString["icode"]; 

strCode will contain the value KUT101

For getting all the values in the URL provided, you can use Split method. See below link for example:
http://forums.asp.net/t/1250996.aspx/1[^]
 
Share this answer
 
Comments
Manas Bhardwaj 22-Jun-12 6:10am    
This makes sense. It was my guess as well that OP needs to read QS. +5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900