Click here to Skip to main content
15,891,204 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
in my web application i have 2 dropdowns for categories...in a button click i need to bind the url from database corresponding to the selected categories...

For example

my url----> http://localhost:1232/tollfree.aspx

im selecting category1 as ---->Jewellery Shops
category2 as ---->ABC Diamonds

after button click my url should be

http://localhost:1232/tollfree.aspx/abc-diamonds-toll-free-number

how can i bind this url from database???
Posted

1 solution

Try this:
C#
string AddValue = "abc-diamonds-toll-free-number"; //Suppose "abc-diamonds-toll-free-number" is coming from database.
stirng absoluteURL = Request.Url.AbsoluteUri + "/" + AddValue;


Now you can redirect your application to absoluteURL.
Use:
C#
Response.Redirect(absoluteURL);


--Amit
 
Share this answer
 
Comments
Sundar PKS 22-Feb-13 4:56am    
Thanks Amit 4 ur reply

but if do another search url gets added like tis...

http://localhost:1232/tollfree.aspx/abc-diamonds-toll-free-number/xyz-gold-toll-free-number
_Amy 22-Feb-13 5:03am    
Welcome. :)
Everytime you need to clear the string absoluteURL after using it.
absoluteURL = "";

--Amit
Sundar PKS 22-Feb-13 5:17am    
i hv already tried this...

AbsoluteUri gets changed after submission...so wen v add our database driven url to this AbsoluteUri it goes on adding.....
_Amy 22-Feb-13 5:20am    
Oh! I missed that one. First time store Request.Url.AbsoluteUri in session/hidden field. And every time take it from session/hidden field.

--Amit
Sundar PKS 22-Feb-13 5:37am    
ya i too thought of tat....but wat i exactly need is like url rewriting from database in which v can use tat url in future.... jus like search engines....

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