Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NETC#4.0
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 21-Feb-13 22:15pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Try this:
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:
Response.Redirect(absoluteURL);
 
--Amit
  Permalink  
Comments
sundarpks at 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 at 22-Feb-13 5:03am
   
Welcome. :) Everytime you need to clear the string absoluteURL after using it. absoluteURL = ""; --Amit
sundarpks at 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 at 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
sundarpks at 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....
_Amy at 22-Feb-13 5:53am
   
Then take a look at these links: URL Rewriting with ASP.NET[^] URL Rewriting in ASP.NET[^]
sundarpks at 22-Feb-13 6:19am
   
Thanks Amit for ur replies....

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 545
1 OriginalGriff 498
2 sanket saxena 330
3 Abhinav S 280
4 thatraja 275
0 Sergey Alexandrovich Kryukov 8,372
1 OriginalGriff 4,830
2 Peter Leow 3,784
3 Maciej Los 3,515
4 Er. Puneet Goel 3,107


Advertise | Privacy | Mobile
Web04 | 2.8.140415.2 | Last Updated 22 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid