Showing posts with label instead. Show all posts
Showing posts with label instead. Show all posts

Thursday, March 22, 2012

Server.Execute vs Server.Transfer

Hello,
I have read that you can workaround the common problem of the Thread.Abort exception by using the server.execute method instead of server.transfer when transfering to another page.

I started using server.transfer in order to make the URLReferrer property of the HTTP request show up properly when using smart navigation in the app. This worked fine, but I get the Thread.Abort execeptions now and then.

Will server.execute still allow the HTTP Request to contain a valid URLReferrer value like the server.transfer call did?

Thanks.From the docs (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebHttpServerUtilityClassTransferTopic2.asp):

"Transfer calls End which raises a ThreadAbortException exception upon completion."

Tuesday, March 13, 2012

Server.MapPath

I remember reading somehwere that in some situations you should not use Server.MapPath and instead there was some other function you should use. Unfortunatly I don't recall where I read it or what the function was. Can anyone refresh my memory?

-SteveWhen your code is run in design mode (VS.NET or WebMatrix), Server.MapPath doesn't provide a useful path. There is no alternative method built into ASP.NET to solve this in design mode. If you are looking for a solution in design mode, ask and I can provide a third party solution.