Solved

error using <%@ Import Namespace="System.Web.Routing" %> in VisualStudio 2010

Posted on 2012-04-10
6
468 Views
Last Modified: 2012-05-12
Hi, I have a project using web.routing.

When I try it with Visual Studio 2010 don't work when i try the url  http://localhost/www.decooutlet.es/admin/new the Explorer gives error 404,

but if i try with the IIS Administator it Works correctly.
0
Comment
Question by:limmontreefree
  • 4
  • 2
6 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 37831279
can u post the routing code in the server side?
0
 

Author Comment

by:limmontreefree
ID: 37831606
Yes, in the web.config:

<assemblies>
      <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
      <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                  <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add assembly="System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
 </assemblies>

  <system.webServer>
        <modules runAllManagedModulesForAllRequests="true">
            <remove name="UrlRoutingModule"/>
            <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
            <!--<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>-->
        </modules>
        <handlers>
            <!--<add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>-->
            <add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
        </handlers>
    </system.webServer>


the global.asax:


<%@ Application Language="VB" %>
<%@ Import Namespace="System.Web.Routing" %>

<script runat="server">
   
    Public Sub RegistraRuta()

       
        RouteTable.Routes.MapPageRoute("admin-novedades", _
                           "admin/novedades", _
                           "~/wfNewsAdminListado.aspx")
       
        RouteTable.Routes.MapPageRoute("admin-novedades-editar", _
                           "admin/novedades/{tipo-mov}/{*id}", _
                           "~/wfNewsAdminAgregarEditar.aspx")
       
        RouteTable.Routes.MapPageRoute("admin-novedades-ultimas", _
                           "novedades/ultimas", _
                           "~/wfNewsUltimas.aspx")
       
        RouteTable.Routes.MapPageRoute("admin-novedades-detalle", _
                           "novedades/{id}/{title}", _
                           "~/wfNewsDetalle.aspx")
       
    End Sub
   
    Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' Código que se ejecuta al iniciarse la aplicación
        RegistraRuta()
   
    End Sub
   
    Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
        ' Código que se ejecuta durante el cierre de aplicaciones
    End Sub
       
    Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
        ' Código que se ejecuta al producirse un error no controlado
    End Sub

    Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' Código que se ejecuta cuando se inicia una nueva sesión
    End Sub

    Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
        ' Código que se ejecuta cuando finaliza una sesión.
        ' Nota: El evento Session_End se desencadena sólo con el modo sessionstate
        ' se establece como InProc en el archivo Web.config. Si el modo de sesión se establece como StateServer
        ' o SQLServer, el evento no se genera.
    End Sub
       
</script>


Thanks.
0
 
LVL 42

Expert Comment

by:sedgwick
ID: 37831613
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:limmontreefree
ID: 37831726
Sorry teh URL http://localhost/admin/new is an example the correct url that dont'w wotk is:

http://localhost/admin/novedades

But Don't work if I try in the visual studio 2010 but works fine in the ISS managenement.

thanks.
0
 

Accepted Solution

by:
limmontreefree earned 0 total points
ID: 37937319
mystery Solved

The name's folder was www.myproyect.com so the routing didn't work.

Thanks everybody
0
 

Author Closing Comment

by:limmontreefree
ID: 37959962
The problem was in the name's folder it has "." and the routing didn't work.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now