简体   繁体   中英

Issue with Response.Redirect and Page.ResolveUrl in ASP.NET WebForms site hosted on Amazon AWS

I have deployed an ASP.NET WebForms site to Amazon AWS to the following link ('webapp' is just a dummy name I haven't included the real url)

http://webapp.elasticbeanstalk.com

My problem is that wherever I do a redirect using Response.Redirect (for example Response.Redirect('~/Page.aspx') or create a link using Page.ResolveUrl (for example Page.ResolveUrl('~/Page.aspx'), the url becomes

http://webapp.elasticbeanstalk.com/webapp_deploy/Page.aspx

But I want it to be simply:

http://webapp.elasticbeanstalk.com/Page.aspx

My guess is that the site is located in a folder called 'webapp_deploy' on the Amazon server and the home sign '~' gets mapped to 'webapp_deploy'.

Is this a known issue or am I doing something wrong ? Are there any workarounds to this...do I need to change something in the AWS console ?

Thanks

By default, your web application will be deployed to webappname_deploy, but you can change that in the Project Properties.

  • In the Solution Explorer, right-click on the web project and select "Properties".
  • In the properties pane, go to the "Package/Publish Web" tab.
  • On that tab, there is a form field labeled "IIS Web site/application name to use on the destination server:"
  • Remove webappname_deploy, so it would just say "Default Web Site/"

Your web app will then be deployed to the root of the IIS Default Web Site.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM