blah blah blah is here! blah blah » Close

up1down
link

I wish to create like a sub-folder to the site that each sub-folder represent is checked with the database and if found loads the page "www.debugging.com/center.aspx?id=test" but with different content.

For Example:
Collapse
http://www.debugging.com/test
to
www.debugging.com/center.aspx?id=test
or

www.debugging.com/example
to
www.debugging.com/center.aspx?id=example

Those to links go to the same page name example named center.aspx but according to the text behind the "/" gets the information. if it exists in the database.

My site structure also have fixed sub folders.

How can I implement this. Already read this and some other sites

http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx
Server Info:
IIS 7
ASP.NET 3.0, 3.5 & 4.0
Has URLRewrite Module

----------------------------

I followed this site instructions.
Approach No 3.
http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx The Problem I have is that the css and javascript location even the images are being passed to the page as a query string.

<link href="css/home.css" rel="stylesheet" type="text/css" />
<link href="css/2.css" rel="stylesheet" type="text/css" />

C#
if (Request.QueryString["qry"] != null)
{}


in qry first play receives the correct parameter. than i press play and the breakpoint triggers again with "css/home.css" as the parameter etc.
<rewriter>
<rewrite url="~/mt/(.+)" to="~/mt.aspx?qry=$1" />
</rewriter>

Clifton
28

I followed this site instructions. Approach No 3. http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx The Problem I have is that the css and javascript are being redirect as a path to the quer string so each link is passing through the page load method.

last answered one year ago

2 answers

up-1down
link

Hi

i am not a web programmer but while toying around with this previously i believe you can do this with master pages and then create a placeholder in which you can call content by means of a usercontrol?

I guess as you are a looking at web based programming you are already aware of this?

A good overview of this can be found here (with example code): http://msdn.microsoft.com/en-us/library/wtxbf3hh.aspx

another link showing content place holders such as your explanation can be found here: http://www.asp.net/master-pages/tutorials/multiple-contentplaceholders-and-default-content-cs

Hope this goes someway to help

psymon25

up1down
link

Followed these instructions http://www.4guysfromrolla.com/articles/051309-1.aspx
and http://msdn.microsoft.com/en-us/library/cc668201.aspx

Using url rewriting.

in the global.aspx I added so when calling files that exists will be brought directly and not routed.

void RegisterRoutes(RouteCollection routes)
{
routes.RouteExistingFiles = false;
.............

Feedback