Best Practice For Making Links That Take Advantage Of Clean Urls

Mar 24, 2011

I'm using ASP.NET 4 and the routing engine. In my Global.asax I have something like this.

routes.MapPageRoute(
"Items",
"manager/items",
"~/Manager/Item/Items.aspx"
);

Is writing a link this this acceptable?: <a href="/Manager/Items"></a> Should I be using the <% %> tags and code within to retrieve the route name, "Items" in this case?

View 1 Replies


Similar Messages:

ASP Routing Be Used To Create "clean" URLs For .ashx Handlers?

Jul 29, 2010

I have some REST services using plain old IHttpHandlers. I'd like to generate cleaner URLs, so that I don't have the .ashx in the path. Is there a way to use ASP.NET routing to create routes that map to ashx handlers? I've seen these types of routes previously:

// Route to an aspx page
RouteTable.Routes.MapPageRoute("route-name",
"some/path/{arg}",
"~/Pages/SomePage.aspx");
// Route for a WCF service
RouteTable.Routes.Add(new ServiceRoute("Services/SomeService",
new WebServiceHostFactory(),
typeof(SomeService)));

Trying to use RouteTable.Routes.MapPageRoute() generates an error (that the handler does not derive from Page). System.Web.Routing.RouteBase only seems to have 2 derived classes: ServiceRoute for services, and DynamicDataRoute for MVC. I'm not sure what MapPageRoute() does (Reflector doesn't show the method body, it just shows "Performance critical to inline this type of method across NGen image boundaries"). I see that RouteBase is not sealed, and has a relatively simple interface:

public abstract RouteData GetRouteData(HttpContextBase httpContext);
public abstract VirtualPathData GetVirtualPath(RequestContext requestContext,
RouteValueDictionary values);

So perhaps I can make my own HttpHandlerRoute. I'll give that a shot, but if anyone knows of an existing or built-in way of mapping routes to IHttpHandlers, that would be great.

View 4 Replies

Mvc - Manage Urls / Links And Routing Centrally (c# + Js)?

Jan 19, 2011

I keep running into problems with URLs and routing. Couldn't find an answer on SO. I would like to manage all of my urls/links in a single place. This is for my C# MVC code and the js/jquery ajax code. These urls are scattered throughout my application. Moving to a production server needs some fixes and I don't like the fact that I need to look for all of the occurrences in the application. I don't mind fixing this once - but I would like to do it only once. how to manage all of these links/urls as a group

View 3 Replies

MVC :: Making Downloadable File Links?

Jul 14, 2010

How can i make a downlandable file links in asp.net mvc for downloading the files.Also how can i show the file as thumbnail in my page in asp.net mvc.

View 4 Replies

Forms Data Controls :: Making Href Links Invisible

May 1, 2010

If a session variable is set to a certain value, I would like to make a href link invisible.

View 6 Replies

Links In Master Page With Tilde URLs Give 404 Depending On The Page?

Nov 22, 2010

Here's an odd one.

I have a master page with links to other pages in the site. Those links use tilde paths (like "~/dir1/page2.aspx"). On most of the pages in the site that use this master page, there is no problem. The problem only seems to be on a few pages that use the master page, the links are VERY wrong, it tries to use the ~ as part of the link (so they are[URL]. It's as if it is treating the tilde as a literal under certain

View 1 Replies

Configuration :: Finding Best Practice For Making Sure That Slow Pages Don't Affect Other Pages?

Aug 31, 2010

Page B - loads slowly and needs to do some CPU-intensive operations on the web server.

I noticed that when someone is loading Page B, then Page A also loads slowly. This is even worse if multiple users are loading Page B at the same time. Page A won't finish loading until Page B is done.

Is there a best practice for making sure that Page A can still load quickly? Maybe a config setting or IIS setting that I need to change from its default? With 2 users loading Page B at the same time, the web server CPU usage only gets to 30% so I suspect it might be something I can tweak with the settings.

View 1 Replies

Logic For Fixing Relative Urls To Full Urls

Nov 16, 2010

i have a function that pulls URLs from various web resources. needless to say some are full valid URLS and some are relative as per the HTML of the page. below is my asp.net/ c# logic i derived for examining the URL and then generate a full usable URL from whats pulled from the site...

NOTE:
origianlurl is the full url of the first searched page, and relativeUrl is a url found within the searched page (it can be a full www.site.com or a /contactus.html)
private string ResolveRelativePaths(string relativeUrl, string originatingUrl)
{
if (relativeUrl.StartsWith("http") || relativeUrl.StartsWith("www"))
return relativeUrl;
if (relativeUrl.StartsWith("/"))
{
//get main url something.com
[code]...

View 1 Replies

ADO.NET :: Performance Advantage To Using EF?

Mar 14, 2011

I'm now getting into EF and from what I'm seeing so far, I wouldn't have to worry about writing stored procedures any more. Looks like EF takes care of all of that -- including INSERT's that store data in multiple tables. One of the things they taught us when learning stored procedures was that they're compiled which has performance benefits. How does EF 4 fare against using stored procedures?

View 3 Replies

WCF / ASMX :: What Is The Advantage Of A Mex Endpoint

Feb 8, 2011

What is the advantage of using a Mex Endpoint over setting

[code]....

I am not able to add the service using Add Service Reference. I am not able to get the WSDL using a browser.

2. If I add the tag <serviceMetadata

httpGetEnabled="true"

and remove Mex Endpoint, I am able to query the wsdl using browser and I am still able to add a refernce using Add Service Reference.

Then, What's the specific use of Mex Endpoint.

View 2 Replies

.net - Advantage To Use ASPX / C# Vs J2EE

Aug 4, 2010

I am supposed to create a intranet web application and the question is what technology I will use? is that the ASPX with C # or the Java EE. in any case I want to know the great advantages that I will receive.

View 4 Replies

Advantage Of Themes Versus CSS?

Jan 24, 2010

Since Themes in ASP.NET are used to style elements of your site, I was just wondering why would you use Themes rather than CSS, or is it common practice to use both? If so, when would you opt for one versus the other and why?

Just seems to me like Themes are kind of unnecessary, so I am just looking on clarification if there really is a good reason to use them, or it's just a part of the framework as an alternative(unnecessary) step to styling your site.

View 2 Replies

MVC :: What Is The Biggest Advantage In Comparison With Webform

Jul 25, 2010

I hate webform that no matter what action is done with a client side page(such as clicking a dropdownlist to only see the Items), it cause a postback&re-rendering of the whole page and all of the page events is raised( page_init,page_load....complete....).

We know that the server side .cs page shoudnt have to go through all the events and many methods(such as "IsPostback",viewstate), in fact,it just have to do only one thing:get data from DB for the dropdownlist and show it to us, other part of the page just doesnt have to change.

We may achieve this effect using Ajax, but the key is I dont wanna raise too many useless event .

seems MVC can handle such a problem, one action of browser side is replied by exactly one method,and time isnot waste by raise event...

Is this the biggest advantage of MVC?

View 5 Replies

Biggest Advantage To Using MVC Versus Web Forms

Sep 22, 2010

Possible Duplicate:

MVC versus WebForms

What are some of the advantages of using one over the other?

View 2 Replies

Architecture :: Advantage Of Using MVC And/or Entity Framework

Oct 2, 2010

I am new to Entity frameworks-EF. As, EF is built on top of ADO.NET...If so, will there be any performance issue when we use it?Same way MVC also targets Test Driven , rapid application development only ..What speciality does it add for end-users?As per my understanding ASP.Net 2.0 itself is powerful without MVC and/or EF...

View 7 Replies

Web Forms :: Is There Advantage If Use A Different Domain For Each Country

May 5, 2014

We want to launch our website in two different countries. for that which one is the best option

Use same domain in both country, use different domain for each country

View 1 Replies

AJAX :: Advantage Of Library Instead Of Simple XMLHttpRequest

Mar 4, 2010

I am relatively new with the usage of asp.net and AJAX technologies and i am trying to add some ajax functionality to my web application.So, I was interested in finding out what the advantage is of using asp.net ajax libary and controls over the usage of simple javascript XMLHttpRequest.

View 3 Replies

Architecture :: Advantage Of Singleton Class Over Static?

Mar 30, 2010

See in below I have writtine a

1. Singleton class Emp1 with Display Method and
2. Static Class with Static Method Display.

What is the advantage of singleton class over Static Class with Static members?

[Code]....

View 9 Replies

Web Forms :: Develop Internet Application - What Is The Advantage

Oct 12, 2010

i want to develop intranet application.can i deveop it as a windows application.if it so what is the advantage than web application

if we develop windows application is it requires server?

View 3 Replies

Web Forms :: Data Retrieve In Webpage / What Is Advantage And Disadvantage

Sep 2, 2010

If I use SqlDataSource control in my asp page to retrive data in viewgrid and some dropdownlist control then what is advantage and disadvantage?

View 1 Replies

AJAX :: Trying To Take Advantage Of The Content Delivery Network Support

Jul 26, 2010

I am trying to take advantage of the Content Delivery Network Support and have run into a snag

I set the script manager to look like this

<asp:ScriptManager ID="ScriptManager1" runat="server" EnableCdn="true">

View 3 Replies

Typesafe Coding And The Advantage Of Storing The Object In The Session?

Nov 24, 2010

When i started developing web applications i stored the authentication details of the user in two session variables

Session["UserName"]="username";
Session["Password"]="paswword-123";

But someone proposed me an idea to create a class which holds the UserName and Password properties and on succesful authentication i have been asked to create an instance of the class and set the UserName and Password properties and store that instance in the session.

I have been told that the session object is TypeSafe. Can someone explain what is typesafe coding and the advantage of storing the object in the session.

View 3 Replies

SQL Server :: Advantage And Disadvantage Of Lock In OLTP System?

Oct 15, 2010

i want to know Advantage and Disadvantage of lock in OLTP system??

View 2 Replies

AJAX :: Advantage Of [WebMethod] Function At Aspx Page Called By JS Code?

Dec 19, 2010

I have this function in aspx page.

[Code]....

and I call this function from JavaScript as below:

[Code]....

I want to know what is this technique called and what is the advantage of calling the function on that way

View 3 Replies

WCF Rest Service With A Clean URL?

Aug 24, 2010

I'm considering to host WCF Rest Service that i've built on IIS 7. The URL to access my service will be something like

[URL]

Recently, i've been looking to some REST API implementation with a clean URL like Yahoo API

[URL]

I'm wondering what will be the best WCF host environment (e.g. Windows Service) or any solution (e.g. URL rewrite module) considering that I dont want to have application name and .svc in my URL so that I can have a completely clean URL for my REST API

View 2 Replies







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