Click here to Skip to main content
11,581,081 members (62,494 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET C#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
0 OriginalGriff 210
1 Frankie-C 195
2 Sergey Alexandrovich Kryukov 85
3 F-ES Sitecore 80
4 Andy Lanng 75
0 OriginalGriff 1,108
1 Sergey Alexandrovich Kryukov 785
2 Abhinav S 622
3 F-ES Sitecore 500
4 Suvendu Shekhar Giri 433


Advertise | Privacy | Mobile
Web03 | 2.8.150603.1 | Last Updated 22 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100