[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 636
  • Last Modified:

How to make a Search Cloud in ASP.NET C#

How can I make a webpage with multiple URLs ? (for a Search Cloud control)
I want
http://mywebsite.com/Default.aspx

to be able to access with multiple URLs like
http://mywebsite.com/Tag1.aspx
http://mywebsite.com/Tag2.aspx
...

I already have the tagcloud control, but I don't know how to address a single webpage from multiple URLs.

Thanks !
0
evo_x
Asked:
evo_x
  • 3
  • 3
1 Solution
 
Todd GerbertIT ConsultantCommented:
I think the fact that you're using a TagCloud control is to some extent irrelevant...would it be fair to say that the question is how to open a single ASPX page using different names?
1. You can use a QueryString, making your urls http://mywebsite.com/Default.aspx, http://mywebsite.com/Default.aspx?tag=Tag1 and http://mywebsite.com/Default.aspx?tag=Tag2.  Then in Page_Load you can check the query string:
string requestedTag;
if(Request.QueryString.AllKeys.Contains("tag"))
    requestedTag = Request.QueryString["tag"];

2. You can use URL re-writing - it's a bit more involved but can make the URL's a little easier to read.
0
 
evo_xAuthor Commented:
I want to make it with URL re-writting, I already have pages in my website with rewritten URLs, but I don't know how to implement the tags...
0
 
Todd GerbertIT ConsultantCommented:
What tag control are you using?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
evo_xAuthor Commented:
from Telerik
0
 
Todd GerbertIT ConsultantCommented:
I'm still not really sure what your question is... initially you said How can I make a webpage with multiple URLs ... I don't know how to address a single webpage from multiple URLs, but then you also said  I already have pages in my website with rewritten URLs, but I don't know how to implement the tags...
So here's a an example of a page with a RadTagCloud, the items are statically defined in the <Items> element.  AutoPostBack is true for the TagCloud (so that events, like a click, fire immediately), and I've added an event handler for the TagCloud's ItemClick event.
In that event handler I get the item that was clicked and redirect the browser to the URL /CloudTags/xyz where xyz is replaced by the tag text that was clicked (for example the user might be redirected to /CloudTags/Start).
You would need to use URL re-writing to make that request go to an actual file (but you said you already have that done, so I haven't covered it here).

<%@ Page Language="C#" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

	protected void RadTagCloud1_ItemClick(object sender, RadTagCloudEventArgs e)
	{
		Response.Redirect(String.Format(
			"~/CloudTags/{0}", e.Item.Text));
	}
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
		<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
		</telerik:RadScriptManager>
		<telerik:RadTagCloud ID="RadTagCloud1" runat="server" 
			onitemclick="RadTagCloud1_ItemClick" AutoPostBack="True">
			<Items>
				<telerik:RadTagCloudItem Text="ASP.NET" Weight="12" />
                <telerik:RadTagCloudItem Text="AJAX" Weight="134" />
                <telerik:RadTagCloudItem Text="VB" Weight="56" />
                <telerik:RadTagCloudItem Text="C#" Weight="38" />
                <telerik:RadTagCloudItem Text="Web" Weight="73" />
                <telerik:RadTagCloudItem Text="jQuery" Weight="23" />
                <telerik:RadTagCloudItem Text=".NET" Weight="78" />
                <telerik:RadTagCloudItem Text="Code" Weight="50" />
                <telerik:RadTagCloudItem Text="UI" Weight="80" />
                <telerik:RadTagCloudItem Text="Unit" Weight="20" />
                <telerik:RadTagCloudItem Text="Class" Weight="50" />
                <telerik:RadTagCloudItem Text="Tools" Weight="40" />
                <telerik:RadTagCloudItem Text="Dynamic" Weight="58" />
                <telerik:RadTagCloudItem Text="Telerik" Weight="60" />
                <telerik:RadTagCloudItem Text="HTTP" Weight="64" />
                <telerik:RadTagCloudItem Text="Start" Weight="62" />
                <telerik:RadTagCloudItem Text="Response" Weight="23.7" />
                <telerik:RadTagCloudItem Text="Client-side" Weight="55" />
                <telerik:RadTagCloudItem Text="Default" Weight="8.5" />
                <telerik:RadTagCloudItem Text="Event" Weight="45" />
                <telerik:RadTagCloudItem Text="Property" Weight="24" />
                <telerik:RadTagCloudItem Text="Tests" Weight="81" />
                <telerik:RadTagCloudItem Text="Method" Weight="87" />
                <telerik:RadTagCloudItem Text="DataSource" Weight="34" />
                <telerik:RadTagCloudItem Text="JavaScript" Weight="35.70" />
                <telerik:RadTagCloudItem Text="Server-side" Weight="59.3" />
                <telerik:RadTagCloudItem Text="Accessibility" Weight="15.7" />
                <telerik:RadTagCloudItem Text="HTML5" Weight="90" />
                <telerik:RadTagCloudItem Text="XHTML" Weight="47.8" />
                <telerik:RadTagCloudItem Text="Compliance" Weight="29.45" />
                <telerik:RadTagCloudItem Text="Callback" Weight="53" />
                <telerik:RadTagCloudItem Text="Request" Weight="39.3" />
                <telerik:RadTagCloudItem Text="Postback" Weight="9.5" />
                <telerik:RadTagCloudItem Text="DOM" Weight="65.49" />
                <telerik:RadTagCloudItem Text="Markup" Weight="35.49" />
                <telerik:RadTagCloudItem Text="Trigger" Weight="24.975" />
                <telerik:RadTagCloudItem Text="XML" Weight="43.975" />
                <telerik:RadTagCloudItem Text="CSS" Weight="14.392" />
                <telerik:RadTagCloudItem Text="Object" Weight="85.6" />

			</Items>
		</telerik:RadTagCloud>
    </div>
    </form>
</body>
</html>

Open in new window

0
 
evo_xAuthor Commented:
Thanks!
So I need a database which contains the Tags and associated Routes in order to manage the routing?
Maybe it is better with the QueryString like in your first post and then handle the routes for that?
0
 
Kumaraswamy RCommented:
This question has been classified as abandoned and is being closed as part of the Cleanup Program.  See my comment at the end of the question for more details.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now