如何获得网站名称 [英] How to get the website name

查看:91
本文介绍了如何获得网站名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

谁能告诉,
我有一个包含三个站点的Web应用程序,所以我想获得父站点的名称吗?

实际上我想将文档从一个站点上传到另一个站点文件夹
那怎么可能呢?

在此先感谢

Hi all,

Can any one tell,
I have one web application with three sites so i want to get the name of the parent website?

actually i want to upload the document from one site to another site folder
so how is it possible?

Thanks in advance

推荐答案

没有这样的概念父网站".您所说的网站名称"是什么意思.没有这样的东西.

使用.NET在上传网站的服务器部分上从一个网站上传到另一个网站不是问题.您需要使用类System.Net.HttpWebRequest.

变量的编译时类型应为System.Net.WebRequest,因为运行时类型是由URL定义为对其工厂方法Create的调用的参数.有关代码示例,请参见 http://msdn.microsoft.com/en-us/library/system.net.webrequest.aspx [ ^ ].将属性Method分配给"POST".

在您需要上传文件的站点上,您应该具有上传页面.您的代码应模拟HTTP上传.

有关代码示例和讨论,请参见:
http://bytes.com/topic/c-sharp/answer/268661-how-upload-file-via-c-code [ http://social.msdn.microsoft.com /Forums/zh-CN/ncl/thread/0eb470d1-6180-40a8-adff-c7c5e76ce164/ [
There is no such concept "parent website". What do you mean by "website name". There is no such thing.

Uploading from one website to another is not a problem on the server part of the uploading website using .NET. You need to use the class System.Net.HttpWebRequest.

The compile-time type of the variable should be System.Net.WebRequest, as the run-time type is defined by the URL as a parameter of a call to its factory method Create. For a code sample, see http://msdn.microsoft.com/en-us/library/system.net.webrequest.aspx[^]. Assign the property Method to "POST".

On the site where you need to upload the file you should have the upload page. Your code should simulate the HTTP upload.

For code samples and discussion, see:
http://bytes.com/topic/c-sharp/answers/268661-how-upload-file-via-c-code[^],
http://social.msdn.microsoft.com/Forums/en-US/ncl/thread/0eb470d1-6180-40a8-adff-c7c5e76ce164/[^].

—SA


这篇关于如何获得网站名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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