Friendly Url

G

Guest

I must make a web project. It's a dynamic web site with 3 template and the page content is in a database.
So I have a Url www.mysite.com/template1.aspx?IdPage=2

This is not good if I send a link of any page

Can I make something with .net ( c# ) to intercept someone as www.mysite.com/channel1/page.htm so I can search in my database for the IdPage and return the page?

www.mysite.com/channel1/page.htm not exist is a virtual Page!
The client browse my website with Friendly Url, but all stay on a Db.

I hope you undestand something e you can help me.
Bye
 
A

avnrao

you can write HttpModule to do the job..
google on writing HttpModules..you will get lot of examples.

Av.
 
J

John Saunders

Boni said:
I have try to do this with a httpmodule, but if the client search for
www.mysite.com/channel/pagina.htm, the browser say "the page not exists",
the IIS write a error. It's work only if the page exists on my web site, but
this is not my case.

This is because the .htm extension isn't being handled by ASP.NET, but by
IIS. You have to add a mapping from .htm to ASP.NET. Look at the virtual
directory properties, click Configuration and check the mappings. You'll
want to add one for .htm which is like the one for .aspx.
 
A

avnrao

i tried a simple prototype on this..
in Application_BeginRequest of Global.asax i have this code

if(Request.Path.ToLower().IndexOf("dummypage") > -1)
Server.Transfer("WebForm1.aspx",true);

and it works only for file extensions that are handled by aspnet_isapi.dll.
in your case .HTM is not handled by this dll..hence your handler is not
getting fired.
try changing it to aspx..can you do that??

hth,
Av.
 
G

Guest

I have mapping the htm,html to and now is the asp.net process that say my "Impossible to find the page ". In the mapping options I have uncheck the option "Verify if the page exixsts" ( I have the italian version of IIS and I don't know if this is right translate ), but don't work! It's say that tha page not exists and this is true but I wont intercept this.

thank's for your answers and for your help
 
J

John Saunders

Boni said:
I have mapping the htm,html to and now is the asp.net process that say my
"Impossible to find the page ". In the mapping options I have uncheck the
option "Verify if the page exixsts" ( I have the italian version of IIS and
I don't know if this is right translate ), but don't work! It's say that tha
page not exists and this is true but I wont intercept this.
thank's for your answers and for your help

Your HttpModule isn't working at all? Does it get called for .aspx pages but
not for the .htm pages?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top