Questions tagged [server.transfer]

106 questions
274
votes
16 answers

Server.Transfer Vs. Response.Redirect

What is difference between Server.Transfer and Response.Redirect? What are advantages and disadvantages of each? When is one appropriate over the other? When is one not appropriate?
kedar kamthe
  • 8,048
  • 10
  • 34
  • 46
126
votes
14 answers

How to simulate Server.Transfer in ASP.NET MVC?

In ASP.NET MVC you can return a redirect ActionResult quite easily: return RedirectToAction("Index"); or return RedirectToRoute(new { controller = "home", version = Math.Random() * 10 }); This will actually give an HTTP redirect, which is…
Simon_Weaver
  • 140,023
  • 84
  • 646
  • 689
33
votes
8 answers

Server.Transfer throws Error executing child request. How to resolve?

I have a HttpModule in C# 2.0 which handles exceptions thrown. Whenever the exception is thrown, an error page (aspx) with some querystring will be called. It is done through Server.Transfer(). But when the control tries to execute…
Amit
  • 25,106
  • 25
  • 75
  • 116
33
votes
6 answers

Thread was being aborted

I am using Server.Transfer. Everything works fine, but exception log shows following exception. System.Threading.ThreadAbortException: Thread was being aborted. at System.Threading.Thread.AbortInternal() at System.Threading.Thread.Abort(Object…
Syed Tayyab Ali
  • 3,643
  • 7
  • 31
  • 36
30
votes
0 answers

Response.Redirect and Server.Transfer

Possible Duplicate: Server.Transfer Vs. Response.Redirect What are the differences between Response.Redirect and Server.Transfer in ASP.NET? In what situations would one want to use one instead of the other?
user63438
  • 317
  • 3
  • 3
17
votes
9 answers

Server.Transfer causing Session exception

In my global I have the following code to handle when an error occurs //[..] code goes here Server.Transfer("~/Error.aspx?ErrorID=" + errorId); It used to be a Response.Redirect which worked perfectly except that it changed the url (which is why…
user2110845
  • 385
  • 8
  • 19
12
votes
4 answers

Error: Unable to evaluate expression because the code is optimized

I am getting an error in my asp.net app that reads "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack." protected void btnCustomerProfile_Click(object sender, EventArgs e) { try { …
DNR
  • 3,706
  • 14
  • 56
  • 91
10
votes
1 answer

Server.Transfer in Global.asax

I have a custom error handler in the global.asax's Application_Error method, when an error occurs I use the following code to transfer user to the error page: Server.Transfer("/Error/"); However without specifying the actual page name the code…
Maya
  • 1,414
  • 5
  • 22
  • 43
6
votes
1 answer

Server.transfer changing the URL a second time

I am using Asp.net 2.0. I do a server.transfer from page 1 to page 2. The URL remains page 1. Now I click a link on page 2 and that will transfer me to page 3. So the URL should remain page 1. Instead the browser now shows the URL of page 2. Is…
Yogesh Jindal
  • 592
  • 7
  • 20
5
votes
2 answers

Implementing TransferResult in MVC 3 RC - does not work

Any ideas how to fix the below? There is a great implementation of TransferResult available here, which worked great on MVC 1,2 but doesn't work on MVC 3 RC. public class TransferResult : RedirectResult { public TransferResult(string url):…
Andy
  • 2,670
  • 3
  • 30
  • 49
5
votes
4 answers

Pass data to a URL on a different web server without the QueryString

I've got an .ashx handler which, upon finishing processing will redirect to a success or error page, based on how the processing went. The handler is in my site, but the success or error pages might not be (this is something the user can configure).…
lhan
  • 4,585
  • 11
  • 60
  • 105
5
votes
2 answers

HttpContext.Current.Items cleared via responseMode="ExecuteURL"?

I avoid the default ASP.NET approach of redirecting on errors (as many people do). Clean AJAX code and SEO are among the reasons. However, I'm using the following method to do it, and it seems that I may lose HttpContext.Current.Items in the…
shannon
  • 8,664
  • 5
  • 44
  • 74
5
votes
1 answer

On error in global.asax can't do server.transfer

In my global.asax page I have the following code: Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) server.transfer("err.aspx") End Sub It does not work and I get the folowing error: Object reference not set to an instance of…
user2726716
  • 51
  • 1
  • 2
4
votes
2 answers

In ASP codebehind, is there any benefit to adding the return keyword after a redirect?

I was wondering whether if it was necessary to keep a return statement after my Response.RedirectPermanent call in my codebehind? It doesn't seem like it, but I wanted to confirm with others. Response.RedirectPermanent(vpd.VirtualPath); return; Is…
johntrepreneur
  • 4,514
  • 6
  • 39
  • 52
4
votes
2 answers

How to use Server.Transfer effectively

How to use Server.Transfer("default.aspx") for better performance for navigating within the website. When I use this, it is not changing the url in the address bar. How can I achieve new url by server.transfer. Or (If Not) how can I gain…
Rajaram Shelar
  • 7,537
  • 24
  • 66
  • 107
1
2 3 4 5 6 7 8