what is the url rewriting?how to rewrite the url? give any
example
Answer / chinnu
If you don't like having meaningless URL's for your
visitors (i.e index.aspx?id=3&pid=3932), consider URL Re-
writing. With URL rewriting, you can store all your content
in the database while having user-friendly URL's. Here's a
code snippet to do just this:
void Application_BeginRequest(Object sender, EventArgs e)
{
String strCurrentPath;
String strCustomPath;
strCurrentPath = Request.Path;
strCurrentPath = strCurrentPath.ToLower();
// the URL contains this folder name
if (strCurrentPath.IndexOf( "/SomeSubFolder/" ) > -1)
{
strCustomPath = "getContent.aspx?id=" +
Path.GetFileNameWithoutExtension( strCurrentPath );
// rewrite the URL
Context.RewritePath( strCustomPath );
}
}
The getContent.aspx will take the page name as a parameter
and do a lookup in the database and return the content for
the page. I have left the details out because the point of
the code snippet is to show how to rewrite the URL and get
the data from the database.
| Is This Answer Correct ? | 0 Yes | 2 No |
List some array functions in php?
=== represents what?
2 Answers Ephron Systems, NetTrackers,
Is it worth learning php in 2019?
How to calculate the length of a string?
What is the use of friend function in php?
Is PHP an open source software?
Why do we need abstract class in php?
What are php loops?
What is alias in php?
What is php explain?
Suppose your Zend engine supports the mode <? ?> Then how can u configure your PHP Zend engine to support <?PHP ?> mode ?
1 Answers Rushmore Consultancy,
What is MIME?