コード例 #1
0
        public bool MalmoNetwork()
        {
            ipRangeCheck kominRange = new ipRangeCheck();
            var          rangeList  = new List <IpRange>();

            rangeList.Add(new IpRange(IPAddress.Parse("161.52.0.0"), IPAddress.Parse("161.52.255.255")));
            string adress = kominRange.GetIP4Address();
            bool   result = kominRange.CheckIsIpInRange(adress, rangeList);

            return(result);
        }
コード例 #2
0
ファイル: rss.aspx.cs プロジェクト: carlhaman/malmovideo
        protected void Page_Load(object sender, EventArgs e)
        {
            ipRangeCheck malmo = new ipRangeCheck();

            komin = malmo.MalmoNetwork();

            string queryId = string.Empty;

            if (Request.QueryString["playlistId"] != null)
            {
                queryId = Request.QueryString.GetValues("playlistId").GetValue(0).ToString();
            }

            XmlWriterSettings writerSettings = new XmlWriterSettings();

            writerSettings.Encoding = new UTF8Encoding(false);
            writerSettings.Indent   = true;

            MemoryStream ms = new MemoryStream();
            StreamWriter sw = new StreamWriter(ms, new UTF8Encoding(false));

            XmlWriter writer = XmlWriter.Create(sw, writerSettings);

            writer.WriteStartDocument();
            writer.WriteStartElement("rss");
            writer.WriteAttributeString("xmlns", "atom", null, "http://www.w3.org/2005/Atom");
            writer.WriteAttributeString("version", "2.0");

            if (queryId != "")
            {
                populateXML(queryId, writer);
            }

            writer.Flush();
            writer.Close();

            StreamReader sr = new StreamReader(ms);

            ms.Position = 0;
            string response = sr.ReadToEnd();


            Response.Clear();
            Response.ClearHeaders();
            Response.ContentType     = "text/xml";
            Response.Charset         = "UTF-8";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.Write(response);
            Response.End();
        }