MVC :: URL Routing In Mvc To Exclude Controller/index Name From URL

Oct 21, 2010

I have this url working in my code:

[Code]....

I want to change my url to NOT to include the home/index [Code]....

ie, it should work like

[Code]....

My current Global.asax entry is like:

[Code]....

[Code]....

[Code]....

[Code]....

View 1 Replies


Similar Messages:

Caching - Exclude Routing Parameters In VaryByParam?

Apr 17, 2010

I have a routing setting in my global.asax file:

routes.MapPageRoute("video-browse", "video/{id}/{title}/", "~/routeVideo.aspx");

My routeVideo.aspx page has caching setting:

<%@ OutputCache Duration="10" Location="ServerAndClient" VaryByParam="id" %>

But when I request http://localhost/video/6/example1 and http://localhost/video/6/example2 after this, the page is created again. So I think VaryByParam works for * but I only want compile when id changes. Is there a way to define routing parameters at VaryByParam?

View 3 Replies

MVC 2 Map Routing From One Controller To Another?

Sep 25, 2010

I am using MVC 2.

I have 2 controllers called Application and Note. The application is a loan application. A note can be added to an application.

On my Index I have a grid that displays all the applications, and an action column with a link that says "Add Note".

In my Application controller I have action methods for create and edit. In my Note controller I have action methods for create, edit and delete.

I was wondering if the following is possible when the user clicks on the "Add Note" link to go to a URL like:

Application/1/Note/Create

1 is the application ID. Note would be the Note controller, and Create is the action method in the Note controller. Is something like this possible?

I started with the mapping in my global.asax, but not sure if it is correct:

routes.MapRoute(
null,
"Application/{ApplicationID}/{controller}/{action}",
new { controller = "Note", action = "Create" });

How would I create the link in my grid using the action link?

EDIT:

The grid above is on my Index view in my Home direcotry. So on this grid I need to concatenate the link to display as above. I'm struggling to create this link on my Index view. It's not concatenating correctly. Currently I have this:

Html.ActionLink("Add Note", "Create", "Note", new { ApplicationID = c.ApplicationID }, null)

And it is displaying as /Note/Create/?ApplicationID=1

I need it to display as:

/Application/1/Note/Create

View 1 Replies

Google Index Vs Url Routing?

Apr 5, 2010

I've made the change from querystring asp.net webforms application to an url routing one. Now I'm trying to let google know that there's a new set of urls to be aware of. The G has indexed 133 out of 179 new urls sent in sitemap.xml, but the site:mistral.hr command returns the old querystring version of the links.
This could partly be so because I left the functionality of the old querystring version of the site(for backwards compatibility), and haven't done any 301 redirects(nor do I know how to achieve them in my shared hosting account).
The old querystring and the new url routing both point to the same Default.aspx page.

View 1 Replies

.net MVC Routing To Controller With Optional Parameters

Apr 9, 2010

I have a controller method that is called with many different combinations of URL's. To overcome issue i am using optional parameters.here is my controller method signature...public ActionResult localMembersSearch(string Gender, string calling, [Optional]string Region, [Optional]string County, [Optional]string Town, [Optional]string queryvalues)the first two parameters are not optional but always expect

View 1 Replies

MVC :: Pass ID Value To Home Controller Index Action?

Dec 31, 2010

My query is somehow related to passing the id values as parameters in MapRoute on RegisteredRoute method

routes.MapRoute("MachineGroupList:, PhysicalMachine/ListGroupMachine/{used}/Page/{page}", new {controller="PhysicalMachine", action="ListGroupMachine",id="XNA"});

How can i use {used} value in id ?

My Page have:

<%: Html.RouteLink("<<<", "MachineGroupList", new{used=Model.UsedBy,page=(Model.PageIndex-1),id=Model.UsedBy})%>

My controller for this Action is:

public ActionResult ListGroupMachine(string id, int page=0)
{
....
}

Everytime I call this Action the Id should be of groupBy column; over here it is 'Used' First time I have called this Action from <%html.ActionLink("Machine","ListGroupMachine", new {id=Model.UsedBy})%> But in my Html.RouteLink the id object is not identified in MapRoute method...

View 2 Replies

MVC :: Pass ID Value To Home Controller Index Action? (like Www.test.com/23)

Jun 18, 2010

I want to have the following URL pattern in my MVC application:

www.test.com -> display welcome page

www.test.com/5 -> display article with ID 5

I have set up my Home Controller like this:

[Code]....

When I request www.test.com, everything works as expected (the Index action is invoked with the ID parameter set to NULL).

But when I request www.test.com/5 it says: HTTP 404 Resource not found. When I request www.test.com/?id=5 it works.

View 2 Replies

C# - Using Grasp Controller With MVC Controller - How To Make An Object Always Visible For A Controller

Dec 28, 2010

UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development, that follows the UP(Unified Process). It uses a Grasp Controller pattern to interact with domain classes by some methods like NewSale(), AddNewItemToSale() and CloseSale. In windows form, I can instantiate a object of this class in the UI and then use its methods to perform the actions. This works well in Client apps, but when I use asp.net mvc, I cannot find a way to instantiate an object (one for each user) that was always visible for a Controller (MVC). I cannot insert as an attribute inside Controller because it always create a new one.

View 1 Replies

Web Forms :: Web.Routing Doesn't Work On Server On IIS Routing

Jul 20, 2010

I tried everything I could find, but still does not work on IIS routing.

View 2 Replies

Routing With Web Forms - Could Not Load System.Web.Routing

Dec 12, 2010

I am using:

ASP.NET 3.5 SP1 with Web Forms Routing thru Global.asax (System.Web.Routing and RegisterRoutes)IIS 7

Everything is working fine in my local machine, but it gives the following error in my hosting environment:

Could not load file or assembly 'System.Web.Routing, Version=3.5.0.0, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

I did everything inside my web.config file mentioned in the following link:

[URL]

But I am still getting the above error.

What else am I supposed to do fix the error?

View 1 Replies

Rest WCF Url Routing & Web Forms Routing?

Feb 22, 2011

I have a Web application where i have added a reference to a RESTful WCF. I got the WCF url Routing to work in my webapplication by adding Inherits="RestService.Global" to the Web applications Global.asax.

<%@ Application Codebehind="Global.asax.cs" Inherits="RestService.Global" Language="C#" %>

But then i tried to create url Routing for the Web application and it does not work with the Inherits="RestService.Global" in the Global.asax. If i take it away it works fine. Is there a correct way to do this.

View 1 Replies

Web Forms :: URL Routing And Dynamic Routing?

Jan 31, 2011

I'm trying to create my own CMS and I've gotten a little bit stuck at the stage of URL routing.

I want clean URLs without extensions and I'd like to be able to create and modify them in a web based interface without any messing around with IIS or actual files.

I've seen how to create a static route, but for that I need to go into my Global.asax file and manually add it.I would like to have all of these routes stored in a database so that I can easily modify them later.

Does anyone know how this can be achieved?

Just for extra information, I will be attempting to create a feature so that if a path exists, but is later changed, a 301 redirect is created to the new URL, is this also possible? (My first problem is the main issue, but thought I might ask this as well just in case it makes a difference)

View 2 Replies

Handle MVC Routing Along With Webform Routing

Sep 2, 2010

How to handle asp.net mvc routing along with asp.net webform routing. I have merged my mvc app into my existing web application. In my web application i have implement routing as below:

routes.Add("View Product Details", new Route("Product/{City}/{Manufacturer}/{Name}/{ProductID}/{*ProductType}"));

Similarly i have implemented routing in mvc as below

routes.MapRoute("Product Details",
"Product/{City}/{Manufacturer}/{Name}/{ProductID}/{ProductType}",
new
{
controller = "Home",
action = "ProductDetails",
City= UrlParameter.Optional,
Manufacturer= UrlParameter.Optional,
Name= UrlParameter.Optional,
ProductID= UrlParameter.Optional,
ProductType= UrlParameter.Optional
});

How to handle both pages, as one is custom web form while other is asp.net mvc view?

View 1 Replies

C# - Windows Desktop Search - Force Re-index / Index Now From Command Line?

May 14, 2010

I'm working on a project where we're using Windows Desktop Search (WDS) to index files on a web share and then later allow the user to search via a website for documents in the share.

These documents are transferred to the share via FTP, however it would seem that either the computer never goes idle to index or at some point the indexing stops. Is there a way from the command line or within the program itself to force this to happen without having to re-invent the wheel? Using .NET 3.5 and C#.

View 1 Replies

DataSource Controls :: Creating Cluster Index From View Error / Cannot Create The Clustered Index 'RateViewIndex'

Feb 26, 2010

Here is my code in SQL

[Code]....

Error i am facing is :

Msg 8668, Level 16, State 0, Line 2

Cannot create the clustered index 'RateViewIndex' on view 'NoteToPass.dbo.RateView' because the select list of the view contains an expression on result of aggregate function or grouping column. Consider removing expression on result of aggregate function or grouping column from select list.

View 1 Replies

DataSource Controls :: Difference In Cluster Index And Noncluster Index?

Feb 2, 2010

what is difference in cluster index and noncluster index?

which is faster?how many cluster index and non cluster index per table?

what is composite primary key?on how many columns we can create composite key?

hao many maximum composite key's we can create on one table?

View 2 Replies

MVC :: Out Of The Box MVC2 Controller / Delete Controller Is Refusing To Return Any Class Information

Nov 6, 2010

my MVC2 delete and only my delete controller is refusing to return any class information. Its really similar to my edit function and the views are all auto-generated so I don't see the problem.

Function Delete(ByVal id As Integer) As ActionResult

View 4 Replies

MVC :: Pass Parameter From Controller To View And Back To Another Controller?

Aug 16, 2010

I have a simple model where a Person has Gifts. I have a view which is a list of Gifts belonging to one Person.

My problem is with the Create action for a new Gift. I want it to default to the PersonID that we are already viewing the list of Gifts for. I tried simply passing the last PersonID (they are all the same)

Html.ActionLink("Create New", "Create", new { id = Model.Last().PersonID }) which works fine if there is already at least one Gift for that person but if this is the first Gift I don't have a value.

My Gift List controller knows the PersonID I want to pass but the view doesn't.

How do I pass this PersonID from my Gift List controller to my Gift Create controller via the Gift List view? Or is there a better way to do this?

View 2 Replies

MVC :: Session Vs TempData / How To Persist Values From Controller To Controller

May 30, 2010

I have a filter on my MVC web site. I display some records in a few different controller actions but when moving from one action to another I want to apply those filter values.

How can I persist values from controller to controller?

Should I use Session? TempData?

I am using Structure Map for IOC.

Maybe I could have a class that contains a Property for each Session Value that I use in my application and inject it on the controllers that need session?

View 10 Replies

MVC :: Exclude Field From Validation?

Jun 4, 2010

I have data annotation validators:

[Code]....

On EDITION form I have only fields: 'title' and 'message' (without field 'link'), but for 'link' is still triggered validation. How can I exclude 'link' from validation in action. I have tried:

[Code]....

But this doesn't work. I still see: "The link field is required.". What is the solution ?

View 8 Replies

Exclude <br> Tag From Regex Not To Remove From Text?

Jan 26, 2011

I have code like this

string pattern = "<(.|
)+?>";
System.Text.RegularExpressions.Regex regEx = new System.Text.RegularExpressions.Reg(pattern);
string result = "";
result = regEx.Replace(htmlText, "");

In this "htmlText" will have some html code which also contains break tags. Right now its replacing all the html tags, but I want to leave break tag and replace the rest.

View 2 Replies

MVC :: Bind Exclude Parameter Not Working?

Mar 14, 2010

Isn't the Bind attribute, preferable the Exclude parameter, define any properties that will be excluded from any form update? If so, why does the ModelState is not valid when I do this?

[code]...

View 1 Replies

C# - Exclude An Object During Serialization In XmlSerialize?

Mar 7, 2011

I'm attempting to serialize an object but I would like to exclude one of the objects inside it. I've tried [NonSerialized] and it is still attempting to serialize it when I call XmlSerialize on a Cart object.

[Serializable]
[XmlRoot("Cart")]
public class Cart : ICart
{
// Public Properties
[DefaultValue("")]
public string ID { set; get; }
[XmlIgnore()]
[NonSerialized]
public CartSerializer Serializer = new CartSerializer(this);
}

View 1 Replies

Regular Expression - How To Exclude Certain String

Sep 13, 2010

I have the following regular expression replacement:

[Code]....

how to exclude certain string

View 4 Replies

AJAX :: Exclude Control From UpdatePanel?

Mar 5, 2011

On my MasterPage I use UpdatePanel to update whole ContentPlaceHolder. Example of code you can find below. All content pages work fine with this MasterPage except one. This page is very complex. I noticed that when I disable UpdatePanel in my MasterPage this problematic page works fine. Question: is it possible to exclude something from UpdatePanel - in my example whole page but only this one?

<asp:UpdatePanel
ID="UpdatePanel2"
runat="server">
<ContentTemplate>
<asp:ContentPlaceHolder
id="MainContent"
runat="server">
</asp:ContentPlaceHolder>
</ContentTemplate>
</asp:UpdatePanel>

View 14 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved