ASP.NET 动态 C# 命令
ASP.NET Dynamic C# command
I want to make class for myself and I was writing this code and I hit the wall
public static string url(string example)
{
string back = "";
if(example == "random1")
{
back = "Request.Url.AbsolutePath.ToString()";
}
return back;
}
我想在我的 asp 网络项目示例中使用我的 Request.Url.AbsolutePath.ToString()
命令 > default.aspx.cs > url("random1");
I had searched for a long time before , sorry about low in english :/
你能用这样的东西吗:
public static string url(string example)
{
string back = "";
if (example == "random1")
{
back = HttpContext.Current.Request.Url.AbsolutePath.ToString();
}
return back;
}
甚至更短:
public static string url(string example)
{
return example == "random1" ? HttpContext.Current.Request.Url.AbsolutePath : "";
}
I want to make class for myself and I was writing this code and I hit the wall
public static string url(string example)
{
string back = "";
if(example == "random1")
{
back = "Request.Url.AbsolutePath.ToString()";
}
return back;
}
我想在我的 asp 网络项目示例中使用我的 Request.Url.AbsolutePath.ToString()
命令 > default.aspx.cs > url("random1");
I had searched for a long time before , sorry about low in english :/
你能用这样的东西吗:
public static string url(string example)
{
string back = "";
if (example == "random1")
{
back = HttpContext.Current.Request.Url.AbsolutePath.ToString();
}
return back;
}
甚至更短:
public static string url(string example)
{
return example == "random1" ? HttpContext.Current.Request.Url.AbsolutePath : "";
}