.Net 4 web form url point to root path

Discussion in 'Site Programming, Development and Design' started by aciang, Aug 15, 2011.

  1. Hello,

    I have multiple domains.. they are all run with .net4 (mvc and web form)
    and use rewrite rule for them.

    for my web form application
    why my css url and form action url always point to my root folder path?
    for example.

    my domain folder path:

    when I browse site test1.abc.com and view source.. the css point to folder path instead of the url?

    <link href="domains/test1.abc.com/Styles/Site.css"
    it should be <link href="/Styles/Site.css"

    and for the form action:
    <form method="post" action="domains/test1.abc.com/Account/Login.aspx"
    it should be
    <form method="post" action="Account/Login.aspx"

    Please advise.
  2. and below are the rewrite rules..

    <rule name="rule1" patternSyntax="Wildcard">
    <match url="*" />
    <conditions logicalGrouping="MatchAny">
    <add input="{HTTP_HOST}" pattern="test1.abc.com" />
    <action type="Rewrite" url="domains/test1.abc.com/{R:0}?" />
  3. This is a pretty common issue when hosting multiple domains in the same site. You have a few options:

    Each option lends itself better for different types of web applications. You'll have to play around with your app and see what will work best for you situation.
    Last edited by a moderator: Oct 14, 2015
  4. Thank you jrummell.. :)

Share This Page