How can I change my map route so I can have another dir, and not just the controllers and actions.What I want is to have another directory before the controller so that way I can separate controller per "module"
routes.MapRoute(
"Default", // Route name
"{module}/{controller}/{action}/{id}", // URL with params
new { module = "module", controller = "controller", action = "Index", id = ""}
This is what I want, but the code doesn't work. What more do I need to change to change the MapRoute?
My routes work in the Global.asax, but I created an Area called Dashboard and while it works with the default route, it doesn't when I implement the T4MVC route.
Here's my Dashboard Area Registration class:
[Code]....
If I view this in a browser with the above settings, any Html.ActionLinks render as empty strings, no routing at all.Here's the rendered HTML from the route.
What is this namespaces argument for? It seems to have no impact at all. I have two controllers called ClientUser in seperate namespaces of the same assembly. I specify told the route to look in the *.ClientUIControllers namespace and all I get back is:Multiple types were found that match the controller named 'ClientUser'. This can happen if the route that services this request ('{controller}/{action}') does not specify namespaces to search for a controller that matches the request. If this is the case, register this route by calling an overload of the 'MapRoute' method that takes a 'namespaces' parameter.
The request for 'ClientUser' has found the following matching controllers: RWA.Web.AdminUIControllers.ClientUserController RWA.Web.ClientUIControllers.ClientUserController To be clear I am not actually passing MapRoute the namespace but am instead setting this after the call: route.DataTokens.Add("namespaces", new string[] { controllersNamespace });
I tried to debug MVC2 but it all got a bit too abstracted and with annoying limitations of debugging release build it got too hard. I got up to ControllerTypeCache.GetControllerTypes but I couldn't follow it. I can see that the specified namespace was definiately in the namespaces arg.
I'm wanting the URL to my MVC application to be like:www.site.com/BobWhich would in turn 'redirect' to Home/Details/Bob.I've set up the following MapRoute:routes.MapRoute( _Nothing, _"{personName}", _New With {.controller = "Home", .action = "Details", .personName = ""}, _ New With {.result = New NameConstraint()} _
As I was trying to create an MVC 2.0 application and map nested areas, I ran ran into a lot of issues mapping routes. So, after I troubleshot all of the bugs, I decided to make a screen cast.Solution Files can be access here: MVC 2.0 AreaRegistrationContext RouteMap Demo Solution FilesVideo tutorial of how to Map Areas.[URL]
I am doing some research on themes in asp.net. (Just Learning) is this a practical use of my time? Should I just use css files and if someone wants to modify anything let them use the css to do it? Are themes a waste of my time? I really want to create my app but give the end user the ability to customize the look and feel without jumping through hoops. Can someone push me in the right direction with pros, cons etc
My application uses the default URL http://tempuri.org rather then using specific URL. In my C# code, how do I change the SoapAction? Is it in the ServiceContract? OperationContract? I'm not sure.
how to do routing. My problem basically relates to "logged in" and "logged out routes" and having both as "/".
i.e. I have home/index for logged out user which appears as "/" but this has got me confused as to how I can have home/home for logged in user and still have "/".
I keep getting 127.0.0.1/home/home
I could modify like 127.0.0.1/home - but I want it like "/". My confusion relates to the fact that the "/" [127.0.0.1/] is bound in the routes collection to home/index.
how I can modify the routes dictionary (which will be binded ONCE at the start) so that the "/" can be shared for logged and non-logged users ?
I m trying to modify a .aspx page which i think is precompiled.(Whenever i open any aspx file it contains following "This is a marker file generated by the precompilation tool, and should not be deleted!").Is there any chance that i can modify source and add a little scriplet inside it?
I'm thinking there has to be an efficient and OO way to do this.
I have several textboxes on a data entry page. When I need to make a new entry, I have to clear the text field before making new entries and this has to be done for quite a number of textboxes and across several pages.
Is there a way to use the FindControl method to locate all textboxes on a page and clear their textfields probably using a loop of some sorts?
I'd like to record more information than the default control allows as well as perform actions with the input when the form is submitted but I'm having trouble figuring out how.
So firstly, if I want to record the middlename for example, how would I do that, and by default, where would it go if anywhere?
When the form is submitted, I'd like to take specific input, such as just the middlename for example, and write some linq to sql code to specify when and how it's stored. In what event would I put this code?
I retrieve a record on my database through Page_Load event here's the content of my Code:
hMenuID.Value = Request.QueryString["id"]; //Display information of links on the entries cnDBConnection.ConnectionString = clsFunction.strConnection; cnDBConnection.Open(); cmModule.Connection = cnDBConnection; cmModule.CommandText = "SELECT * FROM modules WHERE id=" + clsFunction.ReplaceString(hMenuID.Value.ToString()); rdModule = cmModule.ExecuteReader(); if (rdModule.HasRows == true) { rdModule.Read(); txtModuleLabel.Text = rdModule["name"].ToString(); txtModuleLink.Text = rdModule["link"].ToString(); cboParentID.SelectedValue = rdModule["menuid"].ToString(); } cmModule.Connection.Close(); rdModule.Close(); cnDBConnection.Close();
So, the data appears on my textboxes and a combo box. I tried to modify the content of my textbox and click on the Update button. Unfortunately, there's no modification that happen. Here's my code in the Update button
I created a new MVC2 project and use the SqlMembershipProvider and Forms Authentication but am not using Roles (yet). Each user has additional information associated with them (e.g. Company) which is stored in a different table than the aspnet_* membership tables.
I store an additional small piece of information in the authentication cookie (e.g. CompanyId), and create a custom identity object during the AuthenticateRequest event and this custom identity object exposes the CompanyId as a property. Thus, CompanyId is available in controller actions that has been decorated with [Authorize].
When creating a new user, I now want to create this additional user information (e.g. Company) and associate it with the user. I realize there are many different ways to do this but since I am fresh to MVC I am soliciting advice about the best way to do this - I want to do it in the best "ASP.NET MVC way".
One option would be to change the AccountController's Register action and after a successful call to MembershipService.CreateUser(), do the work to create the additional info in the database. Doing it this way does not require any modification to IMembershipService etc.
Another option would be to modify the IMembershipService interface (add a "company" or "companyName" parameter to the CreateUser() method), then modify AccountMembershipService's implementation of CreateUser() and do the work to create the additional info in the database there.
And yet another option would be to leave IMembershipService alone and instead create my own IMyMembershipService and MyAccountMembershipService and use those.