Click here to Skip to main content
Click here to Skip to main content

URL Rewriting with ASP.NET

By , 4 Jul 2002
 

How URL rewriting accepts a url and rewrites it

Introduction

One of the most popular extensions to the Apache webserver has been mod_rewrite - a filter which rewrites URLs. For example, instead of a URL such as

http://www.apache.org/BookDetails.pl?id=5
you could provide a filter which accepts URLs such as
http://www.apache.org/Book/5.html
and it will silently perform a server-side redirect to the first URL. In this way, the real URL could be hidden, providing an obfuscated facade to the web page. The benefits are easier to remember URLs and increasing the difficulty of hacking a website.

Mod_rewrite became very popular and grew to encompass a couple of other features not related to URL Rewriting, such as caching. This article demonstrates URL Rewriting with ASP.NET, whereby the requested URL is matched based on a regular expression and the URL mappings are stored in the standard ASP.NET web.config configuration file. ASP.NET includes great caching facilities, so there's no need to duplicate mod_rewrite's caching functionality.

As more and more websites are being rewritten with ASP.NET, the old sites which had been indexed by google and linked from other sites are lost, inevitably culminating in the dreaded 404 error. I will show how legacy ASP sites can be upgraded to ASP.NET, while maintaining links from search engines.

ASP.NET support for URL Rewriting

ASP.NET provides very limited support out of the box. In fact, it's support is down to a single method:

void HttpContext.RewritePath(string path)
which should be called during the Application_BeginRequest() event in the Global.asax file. This is fine as long as the number of URLs to rewrite is a small, finite, managable number. However most ASP sites are in some way dynamic, passing parameters in the Query String, so we require a much more configurable approach.

The storage location for all ASP.NET Configuration information is the web.config file, so we'd really like to specify the rewrites in there. Additionally, .Net has a fast regular expression processor, giving free and fast search and replace of URLs. Let's define a section in the web.config file which specifies those rewrites:

<configuration>
  <system.web>
        <urlrewrites>
            <rule>
                <url>/urlrewriter/show\.asp</url>
                <rewrite>show.aspx</rewrite>
            </rule>
            <rule>
                <url>/urlrewriter/wohs\.asp</url>
                <rewrite>show.aspx</rewrite>
            </rule>
            <rule>
                <url>/urlrewriter/show(.*)\.asp</url>
                <rewrite>show.aspx?$1</rewrite>
            </rule>
            <rule>
                <url>/urlrewriter/(.*)show\.html</url>
                <rewrite>show.aspx?id=$1&amp;cat=2</rewrite>
            </rule>
            <rule>
                <url>/urlrewriter/s/h/o/w/(.*)\.html</url>
                <rewrite>/urlrewriter/show.aspx?id=$1</rewrite>
            </rule>
        </urlrewrites>
    </system.web>
</configuration>

Notice how we have to escape the period in the url element such as 'show\.asp'. This is a Regular Expression escape and it's a small price to pay for the flexibility of regular expressions. These also show how we set-up a capturing expression using (.*) in the <url> element and refer to that capture in the <rewrite> element with $1

Configuration Section Handlers

.Net's configuration mechanism requires us to write code as a "handler" for this section. Here's the code for that:

<configuration>
    <configSections>
        <sectionGroup name="system.web">
          <section name="urlrewrites" type="ThunderMain.URLRewriter.Rewriter,
              ThunderMain.URLRewriter, Version=1.0.783.30976,
              Culture=neutral, PublicKeyToken=7a95f6f4820c8dc3"/>
        </sectionGroup>
    </configSections>
</configuration>

This section handler specifies that for every section called "urlrewrites", there is a class called ThunderMain.URLRewriter.Rewriter which can be found in the ThunderMain.URLRewriter.dll assembly with the given public key token. The public key token is required because this assembly has to be placed into the GAC and therefore given a strong name.

A section handler is defined as a class which implements the IConfigurationSectionHandler interface. This has one method, Create(), which should be implemented, and in our code that is very simple. It merely stores the urlrewrites element for later use:

public object Create(object parent, object configContext, XmlNode section) 
{
    _oRules=section;

    return this;
}

Initiating the rewrite process

Coming back to actually rewriting the URL, as I said earlier, we need to do something in the Application_BeginRequest() event in Global.asax - we just delegate this to another class:

protected void Application_BeginRequest(Object sender, EventArgs e)
{
    ThunderMain.URLRewriter.Rewriter.Process();
}

which calls the static method Process() on the Rewriter class. Process() first obtains a reference to the configuration section handler (which happens to be an instance of the current class) and then delegates most of the work to GetSubstitution() - an instance method of this class.

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

GetSubstitution() is just as simple - iterating through all possible URL Rewrites to see if one matches. If it does, it returns the new URL, otherwise it just returns the original URL:

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

Installing the sample code

Extract the code into a URLRewriter folder, then turn this into a virtual directory using the Internet Information Services MMC control panel applet. Compile the code use the 'Make Rewriter.bat' batch script into the bin sub-folder. Then add bin/ThunderMain.URLRewriter.dll to the Global Assembly Cache by copying and pasting the dll into %WINDIR%\assembly using Windows Explorer. Finally, navigate to http://localhost/URLRewriter/default.aspx and try the demo URLs listed.

None will actually work because there's one last thing we have to be aware of...

Finally

There's one major caveat with all this. If you want to process a request with a file extension other than .aspx such as .asp or .html, then you need to change IIS to pass all requests through to the ASP.NET ISAPI extension. Unfortunately, you will need physical access to the server to perform this, which prevents you from simply XCOPY deploying your code to an ISP.

Adding a mapping for all file types

We've added the HEAD, GET and POST verbs to all files with .* file extension (ie all files) and mapped those to the ASP.NET ISAPI extension - aspnet_isapi.dll.

A mapping for all file types has been added

The complete range of mappings, including the new .* mapping.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Richard Birkby
Web Developer
United Kingdom United Kingdom
Richard Birkby is a software engineer from London, UK, specializing in .Net. Richard has coded for many different sized companies from small venture-capital funded start-ups, to multi-national corporations (ie Microsoft). When he's not programming, he enjoys driving his sports car or eating curry (although never at the same time!).
 
Richard helps run CurryPages.com and has several other covert ventures in development. Stay tuned!

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionRewrite URLmembermmani55527-Jan-13 23:15 
This is Somewhat helpful.but i want a clear Explanation to Rewrite my URL and Easiest way to write
QuestionURL REDIRECTIONmemberMember 917112831-Jul-12 20:03 
What is URL REDIRECTION?How can i use this concept in my .net?
my task is i have generated one url like this "http://example.com/"
I am passing one pearameter like "http://example.com/Empno=1"
I want to display Ename in Database table that corresponding "Empno"
plz Help me Give me one simple example
 
I am new this concepts
plz Help me send source code to my mailID:mandla.anilbabu@gmail.com
QuestionError On PostBackmembervijay.reddy5927-Jun-12 11:55 
This is working fine ... But on Postback am getting error
 
How to avoid this ?
SuggestionURL rewritingmembersuhel8718-Apr-12 21:39 
Is there is any effect in website if we use url rewriting.?
GeneralMy vote of 4membersuhel8718-Apr-12 21:37 
this really help me out
Questiondefault document SEOmembercsgraham25-Jan-12 2:04 
ive been using this for a long time and it works well - i wonder how i can use this for non duplicate default documents for SEO purposes ?? can i in some way rewrite - www.test.com/index.aspx to www.test.com. basically i want google not to index www.test.com/index.aspx & www.test.com as duplicate content.
 
im trying to find a solution to this but cant seem to get one.
 
any help appreciated.
AnswerRe: default document SEOmemberRichard Birkby25-Jan-12 2:22 
You will need to send a 301 redirect back to the client. URLRewriter works by rewriting the path server-side only.
GeneralMy vote of 2memberUmair Aslam Bhatti15-Dec-11 18:33 
Not descriptive , no sequence , no flow , I didn't get a single word understanding how url rewriting is done , i mean there is no flow.
QuestionURL Rewrite in C#.NETmemberAleksandra Czajka18-Aug-11 13:52 
Hello, I've got a similar article on rewriting here: http://thecodebug.com/?p=363. Let me know what you think and how you like it.
 
aleks
Generalgetting error of the application trust levelmemberkadamnayak3-Jan-11 7:18 
I used this dll and its very much usefull for me, everything works fine in my local machine, when i uploaded on shared hosting it gives trust level error as it requires full trust level and i cant get full trust level on shared hosting. So dou have any idea?
QuestionPlease advise on the error from this app (Description: HTTP 404)membernatzol11-Aug-10 6:20 
Server Error in '/urlrewriter' 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: /URLRewriter/s/h/o/w/5.html
 

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3614
AnswerRe: Please advise on the error from this app (Description: HTTP 404)membermadhgari.rk6-Jan-11 1:03 
hi,
 

use this code if u ajax enabled website
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="false"/>
QuestionError while running on shared hostingmembersudh10325-Apr-10 21:38 
hi Richard,
 
i have create urlrewite it works fine on local but gives error on-line at global.asax "trust permission" error for web.config. i am using asp.net 2.0. I contact my hosting provider for this issue but they tell "As you are using ASP.NET 2.0 or above on the hosting account you only get medium trust."
 
Is there any alternative solution for this? please tell me asap.
 
thanks in advance
 
sudhir
Questionhow do I use 2 parameters?memberEMILIO RAFAEL24-Apr-10 5:12 
What can i do to get this:
 
from:
http://UrlRewriter.org/Books/Maths.html
 
to:
http://UrlRewriter.org/catalog.aspx?family=Books&subfamily=Maths
 
pls, i'll thank you for helping me
QuestionImage Problemsmemberhaitham hamed housin26-Mar-10 4:49 
when I use the module with the site that had images , all images is not appearing
is there a way to make it appear without modifying the imgsrc.
AnswerRe: Image ProblemsmemberBalwant_Singh15-Oct-10 6:13 
<img alt="USERS" src="<%= ResolveUrl("~/images/User.png") %>" />
It will be solved
QuestionHow can I use it wih IIS7?memberDarkness8017-Mar-10 7:36 
Hi,
 
Someone knows how to implement this great solution with IIS7 /Windows 2008?
 
Thanks,
GeneralHi Can you give me the vb.net codememberMember 42274735-Jan-10 22:12 
Dear Sir/Madam
 
could you help to give me the vb.net code.
 
thanks
 
Kosal

Questionhow to avoid case sensitivememberrafiq_22jmr28-Dec-09 2:07 
Nice artice,Thank you very much.
 
I just to know how to write rule for bellow condition.
 
www.example.com/web-folder123.aspx
 
/web-folder123\.aspx
foldername.aspx
 
if i try,www.example.com/Web-Folder123.aspx doesn't work.
 
please help me.
Thank you.
GeneralMy Vote of 5memberf r i s c h3-Oct-09 0:51 
Good article. Helped me out right the way i needed.
 
Thanks.
GeneralRe: My Vote of 5memberAlexTiffy12-Jan-10 1:26 
not good, because you don't update you code ,IConfigurationSectionHandler is invalid, read your article ,i have a try;
GeneralRegarding Url rewriting ArticlememberMember 442566519-Aug-09 4:39 
Hi,
URL Rewriting with ASP.NET[^]
 

Iam new to Urlrewriting Concept. I need More explanation on this article.actually this is not working properly.
Please i will need urgent help.
 
if anybody knows about Urlrewriting..please send me mail with Source code
 
My mail ID: bachi_msc@yahoo.com
 

Please do the needful help.
GeneralHellomemberHtoo Myat31-Jul-09 18:24 
I would like to rewrite url like http://Localhost:port/category/product.For example, http://Localhost:49276/Game/WarCraft .Will it be possible?If it is possible, how can I do so?Confused | :confused:
GeneralHi..memberMember 272372414-May-09 1:17 
As you mentioned the url rewriting ..
 
ie: you are converting .aspx to show as .html or .asp
 
is it possible without changing the setting in IIS??
 
Let me know...???
 
ha

GeneralRe: Hi..membertstuerer8-Sep-09 0:27 
Suspicious | :suss: it is possible
GeneralRe: Hi..memberrafiq_22jmr28-Dec-09 2:13 
kindly explain the steps to implement
Thank you
QuestionRewriting the Domain(URL)memberchalukiyan12-Apr-09 23:04 
I have the url like www.domain.com/administrator/login.aspx and www.domain.com/EndUsers/login.aspx. If the url contains "administrator",the url will be www.Admin.domain.com/administrator/login.aspx
How do I append the "Admin" text in the Url.
Generalnice ideasmemberbharnav13-Feb-09 6:10 
a good starting point for the rewriting affairs. thanks.
Questionneed help urgent pleasememberasmaqureshi82118-Feb-09 22:25 
Confused | :confused:
i download your project its working fine when i open on asp.net2.0 IED all dll class etc etc pages for url rewriting is working fine
BUt when this same Project i open through my local IIS it not work. always show page not found. i already done the IIS conflagrations.
 
I already done this on your
 
Finally
 
There's one major caveat with all this. If you want to process a request with a file extension other than .aspx such as .asp or .html, then you need to change IIS to pass all requests through to the ASP.NET ISAPI extension. Unfortunately, you will need physical access to the server to perform this, which prevents you from simply XCOPY deploying your code to an ISP.
 
but still it not work
please help me how can i run you proj on IIS 5.0
 
i m using IIS 5.0
 
Frown | :( help meConfused | :confused:
 
Asma Qureshi
Web developer
UAE Dubai

QuestionRe: need help urgent pleasememberMember 350106225-Mar-09 1:18 
did u found solution for yr issue?
i am running with same problem
Questionproblem Browsing Image on server and upload images on server.membersoft_jai17-Jan-09 1:34 
I have using FCKeditor.Plone 2.2 iwht our Asp.net Web Application. i set ImageBrowserURL property as our server path like-"http://www.abc.com/Images/", but when i click on browse server button in image property then error is- "Directory Listing Denied" and "This Virtual Directory does not allow contents to be listed." . when i upload image through fck uploader then new folder created in root of application as UserFolder/Images. i want to set uploader server path as our directory like-"http://www.abc.com/Images/" but no way i found.
QuestionUrl Rewriting with Asp.net server controlmembersoft_jai30-Dec-08 20:18 
In My web Application i have used Url Rewriting. when i come from one to another page through url Rewriting. second page contains Asp.net button for some user input. when user Click on this button. Virtual path of page has lost and new url show on url bar like.
 
actual rewrite url is- http://localhost/search/cat1/xyz.aspx.
after postback of button - http://localhost/search/cat1/Default.aspx?id=cat1&catname=xyz
 
Please give solution as soon as posible
AnswerRe: Url Rewriting with Asp.net server controlmembersoft_jai5-Jan-09 2:31 
hi guys i find solution of above problem , by page priInit event.
GeneralUrl Rewriting with Asp.net server controlmembersoft_jai30-Dec-08 3:27 
In My web Application i have used Url Rewriting. when i come from one to another page through url Rewriting. second page contains Asp.net button for some user input. when user Click on this button. Virtual path of page has lost and new url show on url bar like.
 
actual rewrite url is- http://localhost/search/cat1/xyz.aspx.
after postback of button - http://localhost/search/cat1/Default.aspx?id=cat1&catname=xyz
Generaliis 7 windows vistamembersaikus17-Sep-08 12:34 
i cant add the dll in windows/assemblies but with a dll import in the code i resolve it.
the problem is in IIS 7 becouse i cant find the section of mappin to add the reference to aspnet_isapi.dll.
 
Need help Sigh | :sigh:
 
asd

GeneralFor Simplest Way of writing URL RewritingmemberDotNetGuts24-Jul-08 10:29 
I have wrote a article which explains how to write URL Rewriting with simplest example, step-by-step.
 
http://dotnetguts.blogspot.com/2008/07/url-rewriting-with-urlrewriternet.html[^]
 
DotNetGuts
"Lets Make Programming Easy"
 
Logon to www.DotNetGuts.2ya.com
Join Us @ DotNetGuts@YahooGroups.com

Generalproblem with url rewritememberFadi Lteif27-Jun-08 11:03 
Hello
I just installed ThunderMain UrlRewrite and it is working perfect.
i needed it to provide simple url for my customers at sellyourhome.ca
so if someone has a listing ID=70 then his url is
www.sellyourhome.ca/70 which maps to www.sellyourhome.ca/propertyview.aspx?listingid=70
 
the problem i am having is the processing of some images, some images are not loading, when i load the image directly in the browser like this one:
http://www.sellyourhome.ca/images/Uploads/72-1.jpg[^]
Look at the Requested URL, it is pointing to propertyview not to the image itself.
but some images like this one
http://www.sellyourhome.ca/images/Uploads/60-5.jpg[^]
loads fine.
 
Anyone with experience with the rewriter can help. thank you in advance
 
Fadi
QuestionUrl RewritememberJimBeam4-Feb-08 18:09 
Hi guys,
 
I am new for Url rewrite. A have a questions. The links from extranet
are something like this
Apartments.aspx?State=MA&City=Boston. However, user must see
something on browsers URL
Apartments/MA/Boston.aspx . Essentially just change browser URL, but
I can change the page name it self .
 

Any ideas?
 

jim
GeneralUrl Rewritermemberpratap5574-Feb-08 2:40 
Thank you . Your article did fulfill the need that I had .
pratap557
 

One more Question:
what is the need of MakeRewriter.bat file , Does I need the dll ? When I have the Rewriter.cs that compiled to form dll?
I need the same application to work in Master Page too.
 
Thanks. Have nice day.
 

Pratap557
GeneralDon't work on IIS6memberhakervytas14-Jan-08 21:43 
Don't work on IIS6, becouse II6 not support any extensions handling. Any ideas how to hack IIS6 to support any wildcards in metabase that ofcourse start work.Confused | :confused:
GeneralRe: Don't work on IIS6memberdavidbarrett518874-Feb-08 10:05 
Have a look in IIS.. its on the same page but there is now a whole wildcard mapping section instead of the olde stylee way of doing it... its there there is no "hacking the metabase needed"
GeneralXSS Security issue with .RewritePath and Request.RawUrlmemberZombieBob18-Sep-07 11:06 
Thanks for you code BTW we use it a lot. Watchfire came across one of our sites that had an XSS issue even with [pages validateRequest="true"]
 
it seems that by tacking on to the end of a url something like </script><script>alert(82258)</script> to the tail end of an HTML request that the security validator will not pick it up once you have called .RewritePath() with the new URL (only if your rewrite rule does not handle the the extra data)
 
The problem is that in the Request context that Request.RawUrl still contains the full path for your original virtualized Request and it never gets validated even if your happened to strip off some parameters.
 
take for instance /urlrewriter/(.*)show.aspx?test=</script><script>alert(82258)</script> with a rewrite of /urlrewriter/show.aspx?id=$1
 
now if your ASPX code happens to make use of Request.RawUrl the malign JavaScript is still there in it and if you reflect it back into to your webpage, say into a href link you would now have a XSS security problem on your hands.
 
ASP.Net events should be validating on the start against the GET data but it appears not to do so until after the call to .RewritePath() which is very bad on Microsoft part I suppose.
 
I would hate to say that all parts of the URL should be accounted for but all the rewrite rules should be more like url pattern of /(.*)/file.aspx?(.*) first and have a rewrite rule to take care of the parameters after the ? mark like /file.aspx?id=$1&$2 for safety's sake and to keep the validateRequest firing.
 
Better yet all developers should use the Anti-XSS library from Microsoft with reflecting any content that might be able to be compromized.
 
Hope this helps every not to fall in the same hole I did.
 
Kevin Pirkl
GeneralUpdated Versionmemberdnk.nitro13-Sep-07 0:29 
I have slightly 'Improved' the code of the rewriter. Mb it will help resolve issues with working on local dev environment and not working on production.
 
Please note that now it supports stricter regex rules, so it would be much better to write rules as following:
<url>^/urlrewriter/show\.asp</url>
instead of
<url>/urlrewriter/show\.asp</url>
 
using System;
using System.Web;
using System.Xml;
using System.Xml.XPath;
using System.Configuration;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Xml.Xsl;
using System.Reflection;
using System.Runtime.CompilerServices;
 
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile(@"keyfile.snk")]
//[assembly: AssemblyKeyName("")]
//[assembly: AssemblyVersion("1.0.783.30976")]
 

namespace ThunderMain.URLRewriter {
 
     public class Rewriter : IConfigurationSectionHandler {
          protected Dictionary<Regex, string> _oRules = null;
 
          protected Rewriter() { }
 
          public string GetSubstitution(string zPath) {
               foreach (KeyValuePair<Regex, string> pair in _oRules) {
                    Match oMatch = pair.Key.Match(zPath);
 
                    if (oMatch.Success) {
                         return pair.Key.Replace(zPath, pair.Value);
                    }
               }
 
               return null;
          }
 
          public static void Process() {
               Rewriter oRewriter = (Rewriter)ConfigurationSettings.GetConfig("system.web/urlrewrites");
 
               string appPath = HttpContext.Current.Request.ApplicationPath.Length > 1 ? HttpContext.Current.Request.ApplicationPath : string.Empty;
               string inPath = HttpContext.Current.Request.RawUrl;
               string outPath = oRewriter.GetSubstitution(inPath.Remove(0, appPath.Length));
 
               if (outPath != null) {
                    outPath = appPath + outPath;
                    HttpContext.Current.RewritePath(outPath);
               }
          }
 
          #region Implementation of IConfigurationSectionHandler
          public object Create(object parent, object configContext, XmlNode section) {
               _oRules = new Dictionary<Regex, string>();
               foreach (XmlNode oNode in section.SelectNodes("rule")) {
                    _oRules.Add(new Regex(oNode.SelectSingleNode("url/text()").Value), oNode.SelectSingleNode("rewrite/text()").Value);
               }
 
               return this;
          }
          #endregion
     }
}
GeneralRe: Updated VersionmemberRichard Birkby13-Sep-07 1:47 
Thanks. That's a sensible solution for dealing with vroot versus webserver root deployed sites and as you say supports the ability to anchor the start of the regular expression to the website deployment location rather than the root of the webserver.
QuestionSpecified cast is not validmembertiendung910_ntd30-Jun-07 19:36 
Hi, all.
 
I have error at: public static void Process()
{ Rewriter oRewriter=(Rewriter)ConfigurationSettings.GetConfig("system.web/urlrewrites");
...
}
 
this statement have error: Specified cast is not valid.
 
I closed:
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("/bin/keyfile.snk")]
//[assembly: AssemblyKeyName("")]
//[assembly: AssemblyVersion("1.0.783.30976")]
 
in file Rewrite.cs.
 
Help me, please. Cry | :((

 

 
Thanks!

Questiongenerate assemby probemmemberleyeg6-May-07 22:58 
Hi,
In the Rewriter.cs file you declare assemby’s like this :
 
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile(@"keyfile.snk")]
[assembly: AssemblyKeyName("")]
[assembly: AssemblyVersion("1.0.783.30976")]
 
- How are you do to generate the keyfile.snk file ?
- We have also a ThunderMain.URLRewriter.dll on the bin directory, how are you do to genarate this assemby and where is the code that generate the assemby?
 
Brief, if it is possible to show us step by step the way you generate assembies and use them, your article will be very help for beginners !!
 
Bets regards

GeneralITS Urgentmembershhhhhhhhhh23-Apr-07 1:50 
while i am writing this code in web config:
<url>param\.aspx</url>
         <rewrite>UserDetail.aspx?UserID=$0</rewrite>
It rewrite following :
UserDetail.aspx?UserID=$param.aspx instead of writting
UserDetail.aspx?UserID=value of current UserID
pls help
 

Generalproblem in url rewritingmembershhhhhhhhhh6-Apr-07 19:24 
while i am writing this code in web config:
<url>param\.aspx</url>
         <rewrite>UserDetail.aspx?UserName=$0</rewrite>
It rewrite following :
UserDetail.aspx?UserName=$param.aspx while i want UserName="name" here
GeneralRe: problem in url rewritingmemberbbrouwer12-Aug-08 21:47 
You have to do it on this way:
<url>(.*)\.aspx</url>
<rewrite>UserDetail.aspx?UserName=$1</rewrite>
GeneralUrgentmemberbhaskar00126-Mar-07 19:47 
i have little problem .Please give me advise on this it will save my position. Request you to please take a look.
 
for Url Mappings i am using URL Mappings Tab in Web.config file.That is working properly in localhost.But when i am trying to start from IP address it is not working.
 
This is working
ike ==> http://localhost:4683/Rentslicer/California
 
But try to open from IP address it is not working.
like ==>http://125.16.13.139/California
 
but IIS always seems to return the generic 404 error page (“page or directory not found” – there is no “Books” directory on the web root). Any thoughts to what IIS setting might be causing this
 
This is my code




 
Hey i found one solution for this if i put hi

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130619.1 | Last Updated 4 Jul 2002
Article Copyright 2002 by Richard Birkby
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid