Click here to Skip to main content
15,885,366 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Is there any design pattren for authentication in ASp.Net MVC3? Pin
Brij15-Nov-11 1:24
mentorBrij15-Nov-11 1:24 
GeneralRe: Is there any design pattren for authentication in ASp.Net MVC3? Pin
wasimsharp15-Nov-11 1:33
wasimsharp15-Nov-11 1:33 
QuestionWHAT IS SILVERLIGHT. Pin
Shubham Vijay14-Nov-11 21:10
Shubham Vijay14-Nov-11 21:10 
AnswerRe: WHAT IS SILVERLIGHT. Pin
thatraja14-Nov-11 21:37
professionalthatraja14-Nov-11 21:37 
QuestionProblem in playing videos on intranet portal Pin
uspatel13-Nov-11 22:34
professionaluspatel13-Nov-11 22:34 
AnswerRe: Problem in playing videos on intranet portal Pin
jkirkerx15-Nov-11 18:59
professionaljkirkerx15-Nov-11 18:59 
GeneralRe: Problem in playing videos on intranet portal Pin
uspatel15-Nov-11 19:31
professionaluspatel15-Nov-11 19:31 
QuestionURL and Routing problems - MVC model Pin
quanvt13-Nov-11 22:08
quanvt13-Nov-11 22:08 
Hi, everyone. I'm newbie in ASP.NET MVC framework. I've read "Pro asp.net MVC framework" and done a tutorial in this book. But i have problems with route table.

When i run application, the url: http://local:3425 listed some information in the page 1. But when i typed url: "http://local:3425/Page2", it got the error " 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: /Page2"

Thanks in advance for any help.

Here it's the file Global.asax.cs

public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

routes.MapRoute(
null, // Don't bother giving this route entry a name
"", // Matches the root URL, i.e. ~/
new { controller = "Products", action = "List", page = 1 } // Defaults
);

routes.MapRoute(
null, // Don't bother giving this route entry a name
"{controller}/{page}", // URL pattern, e.g. ~/Page683
new { controller = "Products", action = "Act" }, // Defaults
new { page = @"\d+" } // Constraints: page must be numerical
);

//routes.MapRoute(null, "{controller}/{action}");
}

protected void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
ControllerBuilder.Current.SetControllerFactory(new WindsorControllerFactory());
}
}

And file Controller:

public class ProductsController : Controller
{
private IProductsRepository productsRepository;
public int PageSize = 2;

public ProductsController(IProductsRepository productsRepository)
{
this.productsRepository = productsRepository;
}

public ViewResult List(int page)
{
int numProducts = productsRepository.Products.Count();
ViewData["TotalPages"] = (int)Math.Ceiling((double)numProducts / PageSize);
ViewData["CurrentPage"] = page;
return View(productsRepository.Products
.Skip((page - 1) * PageSize)
.Take(PageSize)
.ToList());
}
AnswerRe: URL and Routing problems - MVC model Pin
Not Active13-Nov-11 22:43
mentorNot Active13-Nov-11 22:43 
QuestionError using Eval in asp.net Pin
Vimalsoft(Pty) Ltd13-Nov-11 20:50
professionalVimalsoft(Pty) Ltd13-Nov-11 20:50 
AnswerRe: Error using Eval in asp.net Pin
Anuj Banka13-Nov-11 21:16
Anuj Banka13-Nov-11 21:16 
QuestionDeveloping Employee Portal - Database design question. Pin
Sunil Kokkiligadda13-Nov-11 17:34
Sunil Kokkiligadda13-Nov-11 17:34 
AnswerRe: Developing Employee Portal - Database design question. Pin
biop.codeproject14-Nov-11 15:04
biop.codeproject14-Nov-11 15:04 
GeneralRe: Developing Employee Portal - Database design question. Pin
Sunil Kokkiligadda15-Nov-11 6:11
Sunil Kokkiligadda15-Nov-11 6:11 
GeneralRe: Developing Employee Portal - Database design question. Pin
biop.codeproject15-Nov-11 12:56
biop.codeproject15-Nov-11 12:56 
QuestionHow to protect a page requested only by an external tool or administrator? Pin
TRAORE cheickna13-Nov-11 6:40
TRAORE cheickna13-Nov-11 6:40 
AnswerRe: How to protect a page requested only by an external tool or administrator? Pin
thatraja13-Nov-11 8:40
professionalthatraja13-Nov-11 8:40 
QuestionListView and DataPager in Update Panel Pin
cowcow1234513-Nov-11 6:13
cowcow1234513-Nov-11 6:13 
AnswerRe: ListView and DataPager in Update Panel Pin
thatraja13-Nov-11 8:49
professionalthatraja13-Nov-11 8:49 
GeneralRe: ListView and DataPager in Update Panel Pin
cowcow1234514-Nov-11 1:11
cowcow1234514-Nov-11 1:11 
QuestionHide my flash in iframes Pin
benams13-Nov-11 1:04
benams13-Nov-11 1:04 
AnswerRe: Hide my flash in iframes Pin
Not Active13-Nov-11 3:19
mentorNot Active13-Nov-11 3:19 
AnswerRe: Hide my flash in iframes Pin
Dennis E White14-Nov-11 6:41
professionalDennis E White14-Nov-11 6:41 
QuestionHow to implement an asynchronous code? Pin
TRAORE cheickna12-Nov-11 13:04
TRAORE cheickna12-Nov-11 13:04 
AnswerRe: How to implement an asynchronous code? Pin
Not Active12-Nov-11 16:21
mentorNot Active12-Nov-11 16:21 

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.