Url rewriting Error 404 page not found
-
Hi all. I have a simple urlrewriter. I want to rewrite some path such as mysite/Sale to a special page with parameter like mysite/Find.aspx?y=sale But when I rewrite HttpCuntex.Request to page find.aspx it raise an error:
Error 404 page not found
can not find mysite/sale/find.aspx?s...whats problem?
sepel
-
Hi all. I have a simple urlrewriter. I want to rewrite some path such as mysite/Sale to a special page with parameter like mysite/Find.aspx?y=sale But when I rewrite HttpCuntex.Request to page find.aspx it raise an error:
Error 404 page not found
can not find mysite/sale/find.aspx?s...whats problem?
sepel
sepel wrote:
mysite/sale/find.aspx
Is that file exist in
mysite/sale
path?Navaneeth How to use google | Ask smart questions
-
sepel wrote:
mysite/sale/find.aspx
Is that file exist in
mysite/sale
path?Navaneeth How to use google | Ask smart questions
-
Thanks for your rplay. No.The
/sale
path is virtual. I want to use some virtual path such as:ForRent,Sale,Apartemant..
sepel
The error message is straight forward. Well, where is this
find.aspx
resides? Can you show the code you used for rewriting?Navaneeth How to use google | Ask smart questions
-
The error message is straight forward. Well, where is this
find.aspx
resides? Can you show the code you used for rewriting?Navaneeth How to use google | Ask smart questions
public class SimpleRewriter : System.Web.IHttpModule
{
..
void context_BeginRequest(object sender, EventArgs e)
{
string newUrl = UrlEngine.Engine.ToRealUrl(_application.Context.Request);HttpContext.Current.RewritePath(newUrl, true);
}
}If _application.Context.Request be
mySite/Sale
newUrl get
/Find.aspx?type=Sale
value. Find.aspx is in Root Directory:mySite/Find.aspx
sepel
-
public class SimpleRewriter : System.Web.IHttpModule
{
..
void context_BeginRequest(object sender, EventArgs e)
{
string newUrl = UrlEngine.Engine.ToRealUrl(_application.Context.Request);HttpContext.Current.RewritePath(newUrl, true);
}
}If _application.Context.Request be
mySite/Sale
newUrl get
/Find.aspx?type=Sale
value. Find.aspx is in Root Directory:mySite/Find.aspx
sepel
sepel wrote:
HttpContext.Current.RewritePath(newUrl, true);
A guess. Try passing
false
toRewritePath
method?HttpContext.Current.RewritePath(newUrl, false);
Navaneeth How to use google | Ask smart questions
-
sepel wrote:
HttpContext.Current.RewritePath(newUrl, true);
A guess. Try passing
false
toRewritePath
method?HttpContext.Current.RewritePath(newUrl, false);
Navaneeth How to use google | Ask smart questions
It rises error yet:
Server Error in '/MySite' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies)
could have been removed, had its name changed, or is temporarily unavailable.
Please review the following URL and make sure that it is spelled correctly.Requested URL: /MySite/Sale/find.aspx
I think i must change
/MySite/Sale/find.aspx
to/MySite/find.aspx
. It means i must rewrite Relative Path of httpCuntex.But I don't know how?sepel
modified on Tuesday, January 13, 2009 4:54 AM