简体   繁体   中英

Chrome fails to load resources when using Server.Transfer or Response.Redirect

This is not a "why don't my resources load in Chrome" question.

I have a site in development (VS 2015 - C#). My site starts off like this:

  1. Default.aspx loads
  2. Server.Transfer("view.aspx");

This works fine and all resources (jquery, bootstrap, css files, etc...) load up in IE but fail to load in Chrome.

I have also tried Response.Redirect("view.aspx") and get the same results.

I am passing no content from default.aspx to view.aspx, so there is nothing to preserve there.

If I set the "View.aspx" page to be the startup page, both IE and Chrome work fine. This would seem to indicated that my page/resources/references/etc. are fine.

So, why does Server.Transfer and/or Response/Redirect create a failure to load resources under Chrome but direct navigation seems to be fine?

Try to open developers tools in your web-browser (Chrome) by pressing F12 key. There must be tab "Network". Look there if you got some errors on response.

I also suffering this on Server.Transfer + Chrome , and my error strace shows as below:

Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> 
System.Web.HttpException (0x80004005): Error executing child request for XXX

  at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, 
TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, 
VirtualPath 
path, VirtualPath filePath, String physPath, Exception error, String 
queryStringOverride) 
  at System.Web.HttpServerUtility.Execute(String path, TextWriter writer, 
Boolean preserveForm) 
  at System.Web.HttpServerUtility.Transfer(String path) 

However, It works fine if I use Response.Redirect , and in my research, this issue may result from losing Context inform.

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