weixin_33736048 2017-02-12 09:48 采纳率: 0%
浏览 17

网站发布后的Ajax网址

I developed a site in asp.net. In my site, I have an ajax post which worked when I ran the site locally.

After I publish my site, it looks like the url for ajax post is changed.

I want to align the URL that when running the site locally will be the same as when the site is published

I published the site under folder name ResourceManager (it also the site name)

My ajax URL before publish the site

URL= "/testbed/ConnectTesbedToResource/";\\(<controller_name/method_name>)

after publish the site its NOT working and I need to change the URL to

URL = /ResourceManager/TestBed/ConnectTesbedToResource/;

How I can make sure that the URL will be the same for local run and for publish run?

I tried to change the URL to relative path with ~ (~/testbed/ConnectTesbedToResource/) and it also didn't work.

How can I make that after publish I will have same URL for jQuery post request?

  • 写回答

1条回答 默认 最新

  • 七度&光 2017-02-12 12:58
    关注

    Use URLs without a / at the start - / will make it relative to the site root, which, as you've seen, can change depending on the config of the server and where you install to. Without the / it will be relative to the current page, which is much easier to handle across different install locations

    评论

报告相同问题?

悬赏问题

  • ¥15 matlab中使用gurobi时报错
  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂