9

I'm trying to run a little ASP.NET project in a subfolder of my hosting. My domain is www.gorangligorin.com, but i want to run my app in www.gorangligorin.com/testmvc. ASP.NET MVC runs with no problems on the top level, but not in subfolders.

The server says this (line 58 is colored red):

Line 56:             ASP.NET to identify an incoming user. 
Line 57:     -->
Line 58:     <authentication mode="Forms">
Line 59:       <forms loginUrl="~/Account/LogOn" timeout="2880" />
Line 60:     </authentication>

What can I do to make this ASP.NET MVC website work? This isn't hosted on my computer, so I don't have access to IIS configirations.

3
  • 1
    You cannot make testmvc a virtual directory? Commented Jan 12, 2010 at 13:39
  • I made a virtual directory and it finally works. At least the first page, the sub pages still don't work. It looks like MVC Routing isn't working, because it says "The resource cannot be found." Like I was trying to access a subfolder that doesn't exist. Is there any other setting I have to change? Commented Jan 12, 2010 at 18:43
  • Fixed. I made a stupid typo in writing custom routes and it resulted in not working :) Commented Jan 12, 2010 at 18:51

4 Answers 4

5

The settings of the root application in your IIS may affect your children apps. In order to prevent the root settings from propagating, insert the following code in your root web.config:

<location path="." inheritInChildApplications="false"/>

Hope this helps.

Sign up to request clarification or add additional context in comments.

1 Comment

This works if it is set up correctly... see stackoverflow.com/a/18217352/1339704
3

Did you create a ASP.NET Application in IIS for this directory? Otherwise ASP.NET thinks the root of your server is the root of your application, not the one in the subdirectory.

1 Comment

In a way this was the solution. When I created a virtual directory, there was a check box if I wanted to create an asp.net application in it.
1

Did you try the following?

<forms loginUrl="~/testmvc/Account/LogOn" timeout="2880" />

The tilde (~) is a shortcut for the HttpRuntime.AppDomainAppVirtualPath property, which refers to the virtual application root, not the root of the web server.

HttpRuntime.AppDomainAppVirtualPath

http://msdn.microsoft.com/en-us/library/system.web.httpruntime.appdomainappvirtualpath.aspx

Also, what is up the asterisk?

Line 58:     <authentication mode="Forms">*

2 Comments

This does not help in any way. I've tried with and without ~, with or without /testmvc in front of /account/logon, i've tried account/logon and testmvc/account/logon (without the / infront).
Don't really know how the asterisk came to be, but it's not in the Web.Config or on the error page. I edited the original post.
1

There are Mainly two reasons for this issue:

  1. If you Have not configured your asp.net application in IIS as in to set that Virtual Directory as an Application

  2. Two or many Web.Config Exists on your Site. Since you have the web.config at the root level and the second web.config in the sub-directory. So just remove that web.config if its the same . or go back to 1 and solve it accordingly in the IIS

    And since you added a subdirectory from root, I would say that you have to change your routes in the global.asax file, to handle the routing

Url = "testmvc/{controller}/{action}/{id}"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.