Asp.net在单独的URL中显示HTML页面 [英] Asp.net display a HTML page in separate URL

查看:130
本文介绍了Asp.net在单独的URL中显示HTML页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我昨天刚刚开始创建一个WEB项目。

我使用了很多障碍,但我似乎找不到当前问题的答案。

我有2个WebForms,其中一个名为Default。它工作得很好。我决定添加一个简单的 HTML 页面来显示联系信息。但是当从 Default.aspx 中的按钮单击事件调用它时,HTML在当前页面中显示正确,超过 Default.aspx ,这是合乎逻辑的。

但我想要的是在 www上显示Contact1.html 。!!!。com / Contact1.html

在一个单独的网址中。

所有帮助都表示赞赏。



 <  !DOCTYPE  < span class =code-attribute>   html  >  
< html >
< span class =code-keyword>< head >
< title > 联系< / title >
< meta charset = utf-8 / >

< span class =code-keyword>< style type = text / css >
正文 {
width < span class =code-keyword>: 700px;
}

正文 {
height 503px;
}
< / style >
< / head >
< 正文 >

< center > .... @ gmail.com < / center >

< / body >
< / html >







在Default.aspx.vb中调用Button的事件;

 受保护的  Sub  LinkBtContact_Click(sender 作为 对象,e 作为 EventArgs)句柄 LinkBtContact.Click 
Server.Execute( / Contact / Contact1.html
结束 Sub





我的尝试:



服务器.Execute(  / Contact / Contact1.html

解决方案

改为使用Response.Redirect(url)。


Hi, i just started yesterday to create a WEB Project for the first time.
I sofar managed a lot of obstacles but i seem not to find an answer to my current issue.
I have 2 WebForms, one of which is named Default. It works all fine. I decided to add a simple HTML page, to display contact info. But when it is called from the Button Click Event from the Default.aspx, the HTML displays correct within the current page, over Default.aspx and that is logical.
But what i want is to display the Contact1.html at www.!!!.com/Contact1.html
in a separate url.
All help is appreciated.

<!DOCTYPE html>
<html>
<head>
    <title>Contact</title>
    <meta charset="utf-8" />

    <style type="text/css">
        #body {
            width: 700px;
        }

        #body {
            height: 503px;
        }
    </style>
</head>
<body>

    <center>....@gmail.com</center>

</body>
</html>




At Default.aspx.vb the Event of the Button is called;

Protected Sub LinkBtContact_Click(sender As Object, e As EventArgs) Handles LinkBtContact.Click
    Server.Execute("/Contact/Contact1.html")
End Sub



What I have tried:

Server.Execute("/Contact/Contact1.html")

解决方案

Use Response.Redirect(url) instead.


这篇关于Asp.net在单独的URL中显示HTML页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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