开发者

Problem with application path in IIS7

开发者 https://www.devze.com 2023-01-24 23:09 出处:网络
I am trying to add my application to a live server. My site is in plain html. There are 2 links to go 开发者_JS百科my 2 application. I to go the siteapp and another to go to the main app.

I am trying to add my application to a live server. My site is in plain html. There are 2 links to go 开发者_JS百科my 2 application. I to go the siteapp and another to go to the main app.

In wwwroot I have added my site with a folder name(Lets saye MyWebSite) and configured it in IIS7 with dns ip address. It works fine.

Then I added 2 more subfolder (siteapp & mainapp) for 2 application written in VS 2008 and conver them to application.

So when I go to www.MyWebSite.com/mainAPP/Default.aspx - it works fine But if I click any button(forget password) in Default.aspx- it tries to access www.MyWebSite.com/ForgetPass.aspx and fail. It suppose to go to www.MyWebSite.com/mainAPP/ForgetPass.aspx but it goes to the root for some reason.

If I click a normal a href="www.MyWebSite.com" link it goes to http://www.MyWebSite.com/MainApp/www.MyWebSite.com

I have tried to catch it in global.asax page but no luck

Code in Globacl.asax

Application("AppPath") = ConfigurationSettings.AppSettings("ApplicationURL")
                If Application("AppPath") = "/" Then
                    Application("AppPath") = System.Configuration.ConfigurationManager.AppSettings("ApplicationPath")
                End If
                If Application("AppPath") <> System.Configuration.ConfigurationManager.AppSettings("ApplicationPath") Then
                    Application("AppPath") = System.Configuration.ConfigurationManager.AppSettings("ApplicationPath")
                End If

Code in web.config

<add key="ApplicationURL" value="www.MyWebSite.com/mainAPP/"/>

I am using IIS7

Any idea how can I fix this?


All URLs within the page are relative to the website. So if yo have your website in c:\inetpub\wwwroot, all URLs will be resolved based off that path. Try the following:

<add key="ApplicationURL" value="/mainAPP/"/>

0

精彩评论

暂无评论...
验证码 换一张
取 消