文件操作 - Readbook.aspx.cs
返回文件管理
返回主菜单
删除本文件
文件: E:\HostingSpaces\kimblycr\alex.kimbly.in\wwwroot\Readbook.aspx.cs
编辑文件内容
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.Services; using System.Net; using System.IO; using Newtonsoft.Json.Linq; using Newtonsoft.Json; public partial class ReadBook : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //Check Login through cookies. If not logged in redirect to login/Register if (Request.Cookies["Login"] != null) { string status = Request.Cookies["Login"].Value; if (status != "true") { Response.Redirect("Login.aspx"); } //Check Active subscription or not. If not Active redirect to renew string ID = Request.QueryString[0]; string url = SelectClass.GetDetailsScalar("Books", "ID", ID, "URL"); LiteralControl literal = new LiteralControl(); literal.Text = "<iframe src='" + url + "' style='height: 1000px; width: 100%;' frameborder='0'></iframe> "; //literal.Text = "<iframe src='http://alex.kimbly.in/Books/THE_GOOGLE_STORY.pdf#toolbar=0&navpanes=0&scrollbar=0' style='height: 1000px; width: 100%;' frameborder='0'></iframe> "; // div1.Controls.Add(literal); } else { Response.Redirect("Login.aspx"); } } } [WebMethod] public static string TrackLoc(String Long, String Lat, String user) { string address = GetAddress(Long,Lat); InsertClass.Insert_LoginTrack(user, Long, Lat, address); return "ok"; } public static string GetAddress(String Lang, String Lat) { WebClient client = new WebClient(); string baseurl = "https://maps.googleapis.com/maps/api/geocode/json?latlng=" + Lat + "," + Lang + "&location_type=ROOFTOP&result_type=street_address&key=AIzaSyAhK0jhEeP2JsHGLQaLN2c-0oeu6dynJck"; Stream data = client.OpenRead(baseurl); StreamReader reader = new StreamReader(data); string s = reader.ReadToEnd(); JObject o = JObject.Parse(s); JArray arr = (JArray)o.SelectToken("results"); if (s.IndexOf("ZERO_RESULTS") > -1) { return ""; } else { JValue jv = (JValue)arr[0].SelectToken("formatted_address"); return jv.ToString(); } } }
修改文件时间
将文件时间修改为当前时间的前一年
删除文件