Click here to Skip to main content
15,889,116 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionPls help getting error..The name 'ObjectFactory' does not exist in the current context Pin
sunil319-Apr-16 21:37
sunil319-Apr-16 21:37 
AnswerRe: Pls help getting error..The name 'ObjectFactory' does not exist in the current context Pin
Nathan Minier20-Apr-16 1:53
professionalNathan Minier20-Apr-16 1:53 
GeneralRe: Pls help getting error..The name 'ObjectFactory' does not exist in the current context Pin
sunil321-Apr-16 0:26
sunil321-Apr-16 0:26 
AnswerRe: Pls help getting error..The name 'ObjectFactory' does not exist in the current context Pin
John C Rayan20-Apr-16 2:38
professionalJohn C Rayan20-Apr-16 2:38 
GeneralRe: Pls help getting error..The name 'ObjectFactory' does not exist in the current context Pin
sunil321-Apr-16 0:25
sunil321-Apr-16 0:25 
GeneralRe: Pls help getting error..The name 'ObjectFactory' does not exist in the current context Pin
John C Rayan21-Apr-16 0:32
professionalJohn C Rayan21-Apr-16 0:32 
QuestionFreezing Heading of one DataGrid with data from different datasets Pin
Member 1247018419-Apr-16 20:34
Member 1247018419-Apr-16 20:34 
QuestionHow to use HandleUnknownAction Pin
nasirs516-Apr-16 23:13
nasirs516-Apr-16 23:13 
I am new in MVC. I have some views where there is no need of controller they are static views just some information to be displayed. i searched the web and found (View Without Controller Action in MVC[^]. My controller look like
C#
public class PublicController : Controller
    {
        // GET: Public
        protected override void HandleUnknownAction(string actionName)
        {
            try
            {
                View(actionName).ExecuteResult(this.ControllerContext);
            } 
            catch (Exception e)
            {
                Response.Write("PageNotFound");
            }
        }
    }

i added an entry in routeconfig file as
C#
public static void RegisterRoutes(RouteCollection routes)
        {
            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
            routes.MapRoute(
               name: "NoAction",
               url: "{controller}/{action}/{id}",
               defaults: new { controller = "Public", action = "HandleUnknownAction", id = UrlParameter.Optional }
           );

        }

and i am calling the view from me menu in my master file as
HTML
<ul>
                                <li><a href="@Url.RouteUrl("Public", new { name = "History.cshtml" })">History</a></li>

My history.cshtml file is inside "Public" folder and my controller name is PublicController, i also have pagenotfound.cshtml file which is also in public folder but it always shows me PageNotFound.cshtml file. I dont know how to call my view from my menu. Please help Thanks
AnswerRe: How to use HandleUnknownAction Pin
John C Rayan17-Apr-16 23:24
professionalJohn C Rayan17-Apr-16 23:24 
QuestionMVC asp.net 4.0 "using templates" Pin
Member 1241562115-Apr-16 1:52
Member 1241562115-Apr-16 1:52 
AnswerRe: MVC asp.net 4.0 "using templates" Pin
John C Rayan15-Apr-16 2:00
professionalJohn C Rayan15-Apr-16 2:00 
AnswerRe: MVC asp.net 4.0 "using templates" Pin
John C Rayan15-Jun-16 1:28
professionalJohn C Rayan15-Jun-16 1:28 
Questionworking in MVC4 ..Getting Error pls help Pin
sunil314-Apr-16 19:35
sunil314-Apr-16 19:35 
AnswerRe: working in MVC4 ..Getting Error pls help Pin
F-ES Sitecore15-Apr-16 0:22
professionalF-ES Sitecore15-Apr-16 0:22 
AnswerRe: working in MVC4 ..Getting Error pls help Pin
John C Rayan15-Apr-16 0:24
professionalJohn C Rayan15-Apr-16 0:24 
Questionpartial views connection of index view Pin
Member 1243381313-Apr-16 21:34
Member 1243381313-Apr-16 21:34 
RantREPOST Pin
Richard Deeming14-Apr-16 1:53
mveRichard Deeming14-Apr-16 1:53 
AnswerRe: partial views connection of index view Pin
F-ES Sitecore14-Apr-16 1:57
professionalF-ES Sitecore14-Apr-16 1:57 
Questiontext Pin
Member 1205765613-Apr-16 19:28
Member 1205765613-Apr-16 19:28 
AnswerRe: text Pin
Richard MacCutchan13-Apr-16 20:47
mveRichard MacCutchan13-Apr-16 20:47 
AnswerRe: text Pin
aarif moh shaikh14-Apr-16 18:43
professionalaarif moh shaikh14-Apr-16 18:43 
QuestionAbout AutoMapper In Asp.net MVC4 Pin
sunil312-Apr-16 20:48
sunil312-Apr-16 20:48 
AnswerRe: About AutoMapper In Asp.net MVC4 Pin
Richard MacCutchan12-Apr-16 21:33
mveRichard MacCutchan12-Apr-16 21:33 
GeneralRe: About AutoMapper In Asp.net MVC4 Pin
sunil312-Apr-16 23:38
sunil312-Apr-16 23:38 
GeneralRe: About AutoMapper In Asp.net MVC4 Pin
Richard MacCutchan13-Apr-16 0:38
mveRichard MacCutchan13-Apr-16 0:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.