Forum Moderators: open

Message Too Old, No Replies

i have rewrite url.in Asp. net but not run in live

         

i_am_dhaval

6:29 am on Aug 19, 2009 (gmt 0)

10+ Year Member



i have develop one site ....

every url create like this ...www.mysite.com/newthread.aspx?do=newthread&f=17

i have convert this url in this

www.mysite.com/keyword.html

but when i run in dedicated serve...the html page is not open

what type of setting need for that?

what is the solution...i have windows dedicated server...

i get this error

Server Error
404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.

marcel

7:03 am on Aug 19, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The most likely explanation is that you haven't mapped the .html extension to be processed by aspnet_isapi.dll, but it depends on your setup.

- Which version of IIS are you using
- Which redirect method?

i_am_dhaval

7:15 am on Aug 19, 2009 (gmt 0)

10+ Year Member



IIS 7.0 .....here is the code.........

----

namespace ThunderMain.URLRewriter {

public class Rewriter : IConfigurationSectionHandler {
protected XmlNode _oRules=null;

protected Rewriter(){}

public string GetSubstitution(string zPath) {
Regex oReg;

foreach(XmlNode oNode in _oRules.SelectNodes("rule")) {
oReg=new Regex(oNode.SelectSingleNode("url/text()").Value);
Match oMatch=oReg.Match(zPath);

if(oMatch.Success) {
return oReg.Replace(zPath,oNode.SelectSingleNode("rewrite/text()").Value);
}
}

return zPath;
}

public static void Process() {
Rewriter oRewriter=(Rewriter)ConfigurationSettings.GetConfig("system.web/urlrewrites");

string zSubst=oRewriter.GetSubstitution(HttpContext.Current.Request.Path);

if(zSubst.Length>0) {
HttpContext.Current.RewritePath(zSubst);
}
}

#region Implementation of IConfigurationSectionHandler
public object Create(object parent, object configContext, XmlNode section) {
_oRules=section;

// TODO: Compile all Regular Expressions

return this;
}
#endregion
}
}

---------

marcel

7:35 am on Aug 19, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Looks like you you to map the .html file to the aspnet_isapi, or your ASP.Net code will not run. (this may have changed with IIS7)

Have you considered using the IIS7 URL Rewrite Module [learn.iis.net]?