-
Sep 1st, 2014, 03:22 AM
#1
Thread Starter
Fanatic Member
I need help in MVC 4
I m following article on MVC 4 http://www.codeproject.com/Articles/...al&spc=Relaxed
but i m not getting helloworld text on screen ..Instead its written Index..whne i press F5 the url of screen is http://localhost:65231/
..routeconfig.cs contain following code
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace HelloWorld
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
//routes.MapRoute(
// name: "Default",
// url: "{controller}/{action}/{id}",
// defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
//);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "HelloWorld", action = "Index", id = UrlParameter.Optional }
);
}
}
}
any help
There is no achievement without goals
-
Sep 1st, 2014, 04:04 AM
#2
Re: I need help in MVC 4
If you see a view then your route is presumably working. What we would need to see is your controller and your view.
-
Sep 1st, 2014, 05:26 AM
#3
Thread Starter
Fanatic Member
Re: I need help in MVC 4
here is the controller
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace HelloWorld.Controllers
{
public class HelloWorldController : Controller
{
//
// GET: /HelloWorld/
public ActionResult Index()
{
return View();
}
}
}
and here is the view
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
There is no achievement without goals
-
Sep 1st, 2014, 05:29 AM
#4
Thread Starter
Fanatic Member
Re: I need help in MVC 4
i changed view like this
@{
ViewBag.Title = "Index";
}
<h2>Helloworld</h2>
and its working fine
There is no achievement without goals
-
Sep 1st, 2014, 06:12 AM
#5
Re: I need help in MVC 4
Originally Posted by ERUM
its working fine
So you'll be using the Thread Tools menu to mark this thread Resolved then.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|