Thursday, 23 March 2017

ASP.NET & C#

<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>
<%
 
    Context.Response.ContentType = "text/plain";

     String sree = "mobigesture";
     Response.Write(sree);
     
   
%>
----------------------------------------
http://10.10.1.153/voices/sample.aspx
------------------------------------------

<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>
<%

Context.Response.ContentType = "text/plain";

String sree = Request.QueryString["test"];
Response.Write(sree);
%>

--------------------------------------------------
http://10.10.1.153/voices/sample.aspx?test=HelloWorld
----------------------------------------------


=================================================================
var dataFile = Server.MapPath("~/Persons.txt");
Array userData = File.ReadAllLines(dataFile);

  foreach (string dataLine in userData)
  {
  foreach (string dataItem in dataLine.Split(','))
  Response.Write(dataItem);
 
  }
 
  =========================================
 
 
  <%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>
<%

Context.Response.ContentType = "text/plain";

var dataFile = Server.MapPath("~/Persons.txt");
Array userData = File.ReadAllLines(dataFile);

  foreach (string dataLine in userData)
  {
  foreach (string dataItem in dataLine.Split(','))
  Response.Write(dataItem);
 
  }
%>

===================================================


<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>
<%
 
    Context.Response.ContentType = "text/plain";


    var names = new List<string>() { "John", "Tom", "Peter" };
    foreach (string name in names)
    {
        Response.Write(name+" \n");
    }
%>

=========================================================

<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>
<%
 
    Context.Response.ContentType = "text/plain";


    string[] filePaths = Directory.GetFiles(@"D:\");

    for (int i = 0; i < filePaths.Length; i++)
    {
        Response.Write(filePaths[i]+"\n");
    }
 
%>

====================================================================
<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>
<%
 
    Context.Response.ContentType = "text/plain";

    int caseSwitch = 1;
    switch (caseSwitch)
    {
        case 1:
            Response.Write("Case 1");
            break;
        case 2:
            Response.Write("Case 2");
            break;
        default:
            Response.Write("Default case");
            break;
    }
%>

=====================================================================

No comments:

Post a Comment