Bob Clegg
Bob Clegg

Reputation: 563

Asp.Net 4 File System publishing of Web App

Must be doing something stupid but can't see it. App created from default template using master page Site.Master. 'File System' Published to local folder on Development machine(WinServer 2008 R2, IIS7) Browse to localhost/MyWebApp/Account/login.aspx OK After password validation login.aspx attempts to redirect.

Response.Redirect(@"~/wfMyForm.aspx");

Browser errors with The file '/MyWebApp/wfMyWebForm.aspx.cs' does not exist. I assume the cs file has been compiled into the DLL in the bin directory so why is it attempting to find the Source code file in the Application directory? Have I missed a configuration option or something?

Made a simple test app and get same result. If no code behind file attached to Target page the redirect occurs OK. Attach a code behind file and redirect fails 'no such file'.

<%@ Page CodeFile="wfTest.aspx.cs" Inherits="PubTest.wfTest" Title="" Language="C#" MasterPageFile="Site.Master"  CodeBehind="wfTest.aspx.cs"%>

I have tried various application pools no effect. Thanksfile does not exist

Upvotes: 1

Views: 258

Answers (1)

Zach Green
Zach Green

Reputation: 3460

Sounds like you are using a "Web Site Project" but you are expecting the default behavior of a "Web Application Project".

A comparison of the two: http://msdn.microsoft.com/en-us/library/aa730880%28VS.80%29.aspx#wapp_topic5

Options for precompiling a "Web Site Project": http://msdn.microsoft.com/en-us/library/bb398860.aspx

Upvotes: 1

Related Questions