Welcome to WebmasterWorld Guest from 107.23.176.162

Forum Moderators: ocean10000

Message Too Old, No Replies

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

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

Junior Member

10+ Year Member

joined:Oct 1, 2005
posts:109
votes: 0


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.

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 1, 2005
posts:732
votes: 0


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?

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

Junior Member

10+ Year Member

joined:Oct 1, 2005
posts:109
votes: 0


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
}
}

---------

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 1, 2005
posts:732
votes: 0


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]?