我如何在asp.net中路由我的网址 [英] how do i route my url in asp.net

查看:63
本文介绍了我如何在asp.net中路由我的网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 

我有一个问题我在没有MVC的情况下使用vb.net进行我的网络应用程序,我想用路由重写网址,但我无法做到在这里工作我有正确的代码我不知道什么时候有人可以帮助我。

I have a problem i using vb.net for my web application without MVC , what i wan is to rewrite the url using route but i cant make it work here the code i have right i not sure what when wrong with it can anyone help me up.

Imports System.Web.Routing



公共类Global_asax

   继承System.Web.HttpApplication



    Sub Application_Start(ByVal sender As Object,ByVal e As EventArgs)

         RegisterRoutes(RouteTable.Routes)

   结束分
   共享子RegisterRoutes(路由为RouteCollection)

        routes.MapPageRoute(" Homepage"," Homepage","〜/ Homepage.aspx")

   结束子

Imports System.Web.Routing

Public Class Global_asax
    Inherits System.Web.HttpApplication

    Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
        RegisterRoutes(RouteTable.Routes)
    End Sub
    Shared Sub RegisterRoutes(routes As RouteCollection)
        routes.MapPageRoute("Homepage", "Homepage", "~/Homepage.aspx")
    End Sub




以下此代码在页面加载

谢谢

Johnny

推荐答案

我在MVC解决方案中使用了路由。所有我可以告诉你的是你正在做的事情看起来不正确,看起来你正试图应用MVC路由。

https ://msdn.microsoft.com/en-us/library/cc668177.aspx?f = 255& MSPPError = -2147217396

您还可以发布到各个部分,如MVC和ASP.NET论坛中的其他人。

You can also post to various sections like MVC and others in the ASP.NET forum.

http://forums.asp.net/

http://forums.asp.net/


这篇关于我如何在asp.net中路由我的网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆