404 error when logging in

Topics: ASP.NET 2.0
Jun 26, 2009 at 5:43 PM

Hi Folks,

I have recently attempted to include BlogEngine inside my current website, by installing it into a sub-folder (creatively called "/blog").

I have combined the blog's web.config file with that of the main site and have amended the default settings of the file to include <add key="BlogEngine.VirtualPath" value="~/blog/" />

When I navigate to "sitename/blog" I get the blog's landing page as expected, however, when I try to log in I get a 404 error, as the application is trying to redirect to "default.aspx" in my root folder and not the /blog sub-folder.  My website uses "index/aspx" as the default landing page, hence the 404.

All other navigation within the blog appears to be working fine, just the redirection coming out of log-in that is failing.  I assumed that setting the VirtualPath value to "~/blog/" would have taken care of things, but obviously not, however I cannot find another setting that would fix this.

Any ideas...?

Thanks in anticipation,


Jun 29, 2009 at 10:05 AM

Well, this is silly but...

As part of my ongoing attempt to resolve this issue, I was looking in the codebehind file of the login.aspx file.  I decided to create a variable, q,  and set it to a different value in each section of the code, in order to keep a watch on it while debugging.

As soon as I had done this then the log-in process worked as it should have done.  To double check, I removed by spurious code and the log-in redirect failed once more.  Code back in and all is well.

I can't explain it, but if it ain't broke...



Jun 30, 2009 at 10:01 AM
Edited Jun 30, 2009 at 10:15 AM

Have you trying debugging the application? There is redirect code written in "Login1_LoggedIn" function in login.aspx.cs, just check what does this line returns,

Response.Redirect(BlogEngine.Core.Utils.RelativeWebRoot, true);
RelativeWebRoot should return you "~/blog"