Quantcast
Channel: Visual Studio and Visual Web Developer Express
Viewing all articles
Browse latest Browse all 3509

Problems with VS2019 ASP.NET project and href links

$
0
0

Hi,

I have a problem with the url used in the href attribute for my style sheets. The website should run under a directory I will call /MyWebSite. I have added the virtual directory to my applicationhost.config so that it look like this:

        <sites>
            <site name="WebSite1" id="1" serverAutoStart="true">
                <application path="/">
                    <virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />
                </application>
                <bindings>
                    <binding protocol="http" bindingInformation=":8080:localhost" />
                </bindings>
            </site>
            <site name="Web Site" id="2">
                <application path="/" applicationPool="Clr4IntegratedAppPool">
                    <virtualDirectory path="/" physicalPath="D:\Visual Studio 2019\My Web Site\My Web Site" />
                </application>
                <application path="/MyWebSite" applicationPool="Clr4IntegratedAppPool">
                    <virtualDirectory path="/" physicalPath="D:\Visual Studio 2019\My Web Site\My Web Site" />
                </application>
                <bindings>
                    <binding protocol="http" bindingInformation="*:50380:localhost" />
                </bindings>
            </site>
            <siteDefaults>
                <!-- To enable logging, please change the below attribute "enabled" to "true" -->
                <logFile logFormat="W3C" directory="%AppData%\Microsoft\IISExpressLogs" enabled="false" />
                <traceFailedRequestsLogging directory="%AppData%\Microsoft" enabled="false" maxLogFileSizeKB="1024" />
            </siteDefaults>
            <applicationDefaults applicationPool="Clr4IntegratedAppPool" />
            <virtualDirectoryDefaults allowSubDirConfig="true" />
        </sites>

Now I can open my top page using http://localhost:50380/MyWebSite/StartPage.aspx and all the page links work.

Now, in start page I have the following tag in StartPage.aspx:

<link rel="stylesheet" type="text/css" href="/MyWebSite/Styles/Styles.css" />

However, the style sheet is not being loaded. Can anyone tell me how I can get this to work?

Thank You


Viewing all articles
Browse latest Browse all 3509

Trending Articles