MVC :: Do Areas Have To Reside Off The Root
Feb 12, 2011If I create an Area, does it have to reside off of the root? Or can I create it in a sub-folder? If so, how to you set the MapRoute so you can navigate to rootSecureAreasAdmin?
View 9 RepliesIf I create an Area, does it have to reside off of the root? Or can I create it in a sub-folder? If so, how to you set the MapRoute so you can navigate to rootSecureAreasAdmin?
View 9 RepliesI'm using MVC 2, I need to change the default name "Areas" to <MyOwnAreaName>.
Is't possible to change default name "Areas" to my own name?
I ran into the following issue when trying to run a test website on IIS 7.5 (Windows Server 2008 R2 DatacenterEdition). The web-app is configured to run with framework version 3.5 in a .Net 2.0 app pool. Also the framework 4.0 beta 2 is installed on the server. The application named 'TestPfade' is located under the website's root named 'Default'. It is not only a virtual directory but defined as an application. The folder structure looks like this: The markup of the sole document reads as follows:
[Code]....
When viewed in a browser the image gets shown because the given relative path is correctly resolved to 'images/Lighthouse.jpg' but the paths to the ajax-framework resources also include the application's root folder and therefor aren't found: 'src="/TestPfade/WebResource.axd?d=1bX...' Here is the complete html-source generated:
[Code]....
I am using iis 5.1 in which we have only only one default website, I have two projects v2 and v3 my website points to v2 projects and have some folders images, styles etc now i have a virtual directory under this website that is hosting project v3 and having the same folder hierarchy as v2 in the home page of the both projects i have img src="imagesedlogo.gif" alt="logo"/> but this shows the same image that is in the v2 directory, How can i show different images for both projects. using "" get the root of the web site but how can i get the root of virtual directory under that website
View 2 RepliesHow can you request the root default.aspx without specifying it in the url for your root application?e.g. ttp://localhost/MyApp/ instead of http://localhost/MyApp/Default.aspxshould be able to do bothI'm not sure if this is a setting in IIS 7.5 for the application or what.
View 3 Repliesi have developed a website having 4 aspx pages.
these are stored into wwwroot folder.
now i want to access this website from another computer.
how to do that....(means i want to make a web server and want to deploye my website and also want to access that website from anywhere over the internet)this is easily done into the wemp server but how to do into iis server. Is there any services of iis are dissabled onty any other seetting requiered.
I am starting a new project where I have to use oracle and asp.net. Oracle 11 enterprise edition. Problem is oracle database reside in linux server and application server is in windows. My question is1. Is there any problem connecting oracle from asp.net?
View 1 RepliesI have a page, in my web app, that need to make a call to a web service that reside on the same network of the web server, but the machine with the web service is not directly reachable from the internet. can I set a local ip address in the web config file? es: 192.168.9.2 Or I must only set a public ip address?
View 3 RepliesExternal.dll
IMyClass NewCreated = (IMyClass)Activator.CreateInstance(Namespace.MyClass).UnWrap();
Asp.Net WebSite
App_Code
Namespace.MyClass.cs
Bin
External.dll
Is that even posible? I have tried, a lot of posible combinations, like:
Assembly.GetCallingAssembly().CreateInstance("Namespace.MyClass")
Activator.CreateInstance(AppDomain.CurrentDomain,"Namespace","Namespace.MyClass")
Assembly.GetExecutingAssembly().CreateInstance("Namespace.MyClass")
I'm following this blog post about setting up ELMAH with MVC: [URL] I've only done part 1. Everything works correctly if I simply go to the Home controller, and then cause an error. I can view /elmah.axd as well, and my errors are logging in the database correctly.
However, I've added an area to my application named Admin. If I navigate to /Admin, I receive the following error:
System.MissingMethodException: No parameterless constructor defined for this object.
public override IController CreateController(RequestContext requestContext, string controllerName)
{
var controller = base.CreateController(requestContext, controllerName); //Error here
var c = controller as Controller;
I'm assuming this has something to do with my Area.
EDIT for jfar:
For instance, I have an Employees controller in my Admin area:
public class EmployeesController : Controller
{
private IEmployeesRepository employeesRepository;
public EmployeesController(IEmployeesRepository employeesRepository)
{
this.employeesRepository = employeesRepository;
}
//...
}
To use separation of concern and to optimize the clearness of the controllers we decided to split each action of a controller into different controllers (FunctionalLocationEditController, FunctionalLocationCreateController and such).
Problem now is the Global.asax is currently a bit big for just a few pages registered in routes.
We would need to use an area type of mechanism but for business reason we are not ready to upgrade just yet to MVC2.
Basically, is there a way in MVC1 to map the Urls to something like <folder>/<controller>/<action> ?
Been starting a new project (MVC 2) based on the first version of the same application (MVC 1).In the first we breaked out Controllers and Views into seperate projects, which resuted in a clean and organized structure.Now with version 2, I've been reading about this "Areas".Keeping the old structure and using areas sounds like overkill to me. Keeping the old way OR use Areas is what I'm trying to decide on.Just wanted to hear your thoughts about this.... Is it really that usefull (ie have other benifits)? No use to make some major changes just because something is there IMHO
View 3 RepliesI am wondering if MVC offers a handy function to iterate through all areas. I know I can search the sub-directories of Areas to achieve this. I am just curious.
View 3 RepliesDoes the current MvcRouteHandler support something similar to Monorail's concept of an controller area? a way to group the controllers.
View 1 RepliesI'm starting a new ASP.NET MVC project, and I decided to put my controllers in a different assembly. Evertyhing works fine, but I have hit a problem: I created a new area in my MVC Project, called Administration. I have an AdminController Class in my seperate assembly which is supposed to return views from my Admin area, but everytime it tries to return a view, it looks for it in the wrong place (~/Admin/SomeView.cshtml Instead of ~/Administration/Admin/SomeView.cshtml) How can I tell the controller to look for views in the wanted area?
View 1 Repliesis there some way to share a partial razor view between areas? For example a login partial, it is found if i use @Html.Partial("_LoginPartial") but the URLs Html.ActionLink generates are local to the calling area (even though the partial itself is not part of the area).
_LoginPartial.cshtml is in /Views/Shared/_LoginPartial.cshtml
Calling view is inside /Areas/Somearea/Views
Links generated are like: [URL]
But should always be: [URL]
Partial view source:
@if(Request.IsAuthenticated) {
<text>Welcome <b>@Context.User.Identity.Name</b>!
[ @Html.ActionLink(@Messages.Logout, "Logout", "Account") ]</text>
}
else {
@:[ @Html.ActionLink(@Messages.Login, "Login", "Account") ]
}
I created an Area in my application named Admin. It's pretty basic, looks like this:
Areas
Admin
Controllers
CompaniesController.cs
Models
Views
Companies
Index.aspx
AdminAreaRegistration.cs
When I try to view my Index page by going to /Admin/Companies, I get a "The resource cannot be found" message. I find it weird that I don't get any sort of error message.
Where should I put my common _layout.cshtml file for all of my Areas?
View 4 RepliesI want to structure my ASP.NET MVC 2 web application sensibly using Areas. The application consists of the two main parts Website which is the default part and Dashboard which administrates the site using a CMS. (Probably, more Areas will follow later on.)
How do I structure my project best? Should I ...
create the Area Dashboard and put the stuff belonging to the Website part into the main application folder or should I create both Areas Website and Dashboard?
Additionally, where should I place my Entity Data Model and the corresponding Repository classes that have to be accessed by both Areas?
I have two areas: Frontend and Backend - I would like to have two different error pages - so I have two files NotFound in /Areas/Frontend/Views/Shared/NotFound and /Areas/Backend/Views/Shared/NotFound. I have added also to Web.config in area Frontend:
<customErrors mode="On" defaultRedirect="Error">
<error statusCode="403" redirect="NoAccess" />
<error statusCode="404" redirect="/Areas/Frontend/Views/Shared/NotFound" />
</customErrors>
and in area Backend in Web.config:
<customErrors mode="On" defaultRedirect="Error">
<error statusCode="403" redirect="NoAccess" />
<error statusCode="404" redirect="/Areas/Backend/Views/Shared/NotFound" />
</customErrors>
But when I come in bad website url - for example: http://localhost/Backend/blablabla I don't see my NotFound website but:
Server Error in '/' Application.
The resource cannot be found.
Description:
HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /Backend/blablabla
In my application I have controller named `Snippets` both in default area (in application root) and in my area called `Manage`. I use T4MVC and custom routes, like this:
routes.MapRoute(
"Feed",
"feed/",
[code...]
I've got IIS 6 with a self-signed certificate installed. This is now securing the whole site (all urs are HTTPS). How do I only apply HTTPS to logged in areas, leaving publicly viewable data with HTTP?
View 8 RepliesThis page is a directory search, it has controls identified by record ID, however there exists a situation where there can be more than one result with the same record ID, thus making .NET barf. I had originally implemented a check that just didn't put the control on the page, if it was already there, but we've been getting negative feedback.
My question is this: Is there a way to put the same control in two places at once, for instance having if a user checks one, the corresponding one checks as well? I'm not terribly well versed in how .NET behaves, but I'll try to provide as much additional context as possible, if needed.
EDIT: Here's the updated code that generates the controls by looping over a datatable of results
Dim cbxSendInfo As CheckBox
Dim strCheckboxID As String = "cbxSendInfo-" & drOrganizer("ID") & "-" & i
Debug.text = Debug.text & " Loading Checkbox (" & strCheckboxID & ")...<br />"
cbxSendInfo = New CheckBox
cbxSendInfo.ID = strCheckboxID
cbxSendInfo.enableViewState = true
And here's the code that finds the controls and builds the contact list:
Dim strCheckboxID As String = "cbxSendInfo-" & drOrganizer("ID") & "-" & i
Dim cbxSendInfo As CheckBox = Me.tblResults.FindControl(strCheckboxID)
If cbxSendInfo.Checked Then
alOrganizers.Add(drOrganizer("ID"))
End If
Where drOrganizer("ID") is the record ID, and i is the result record number.
I know this is a terrible way to do this, at least from my background, but like I said, this is inherited code that's been hacked to pieces.
my site I want to calculate the distance between two areas of same city.Like I am using a search criteria where I have a drop down list. In which options are as below.
100km-70km
70km-50km
50km-10km
When user selects any one of the options the schools or shops in the specified area should be displayed. Is it possible to dynamically calculate the distance,
I am not sure how to explain my current issue. Right now I have a Form that spans a couple of pages. I have divided the Form into multiple section as well including a File Upload section, a File Download section, and have an 'Update' button at the bottom of the Form. I also have Error labels within each section, and have an Error label at the bottom of the Form under the 'Update' button.The problem that I am experiencing right now is that when I produce one of these errors, the Form automatically displays the very top of the page. So in other words, if the error message is displayed at the bottom of the Form, the user has no idea unless they scroll all the way down.Is there anyway to keep the application focus at the area where the button is clicked on? This way if the user produces an error, they will see it right away.
View 4 Replies