这是我的代码:
public static TextWriter twLog = null;
private int fileNo = 1;
private string line = null;
TextReader tr = new StreamReader("file_no.txt");
TextWriter tw = new StreamWriter("file_no.txt");
line = tr.ReadLine();
if(line != null){
fileNo = int.Parse(line);
twLog = new StreamWriter("log_" + line + ".txt");
}else{
twLog = new StreamWriter("log_" + fileNo.toString() + ".txt");
}
System.IO.File.WriteAllText("file_no.txt",string.Empty);
tw.WriteLine((fileNo++).ToString());
tr.Close();
tw.Close();
twLog.Close();
Run Code Online (Sandbox Code Playgroud)
它抛出此错误:
IOException:路径C:\ Users\Water Simulation\file_no.txt上的共享冲突
我要做的只是打开一个带有log_x.txt名称的文件,并从file_no.txt文件中取出"x".如果file_no.txt文件为空,请将日志文件的名称设为log_1.txt并写入"fileNo + 1" to file_no.txt.新程序启动后,新的日志文件名必须是log_2.txt.But我收到此错误,我无法理解我做错了什么.谢谢你的帮助.
在服务器上区分来自iPhone的请求是通过网络浏览器与通过iphone与用目标c编写的应用程序之间的最佳方法是什么?我在用户代理字符串中寻找什么差异?
我在IIS中有以下结构.
Internet Information Services
(local computer)
Web Sites
Default Web Site
MyApplication
Run Code Online (Sandbox Code Playgroud)
MyApplication
是IIS中的应用程序.
未设置集成Windows身份验证Default Web Site
.但是,我想要设置集成Windows身份验证MyApplication
.(它是一个内联网应用程序).
这可以通过GUI完成:右键单击Default Web Site
并选择Properties
.选择Directory Security
选项卡,然后单击Edit
匿名访问和身份验证控件.
我想在安装脚本中包含它.我有其他设置命令,adsutil.vbs
但我正在努力设置集成Windows身份验证.
运行:
cscript // nologo c:\ Inetpub\AdminScripts\adsutil.vbs GET/W3SVC/1/NTAuthenticationProviders
返回
NTAuthenticationProviders : (STRING) "NTLM"
Run Code Online (Sandbox Code Playgroud)
但是,我已经完成了能够运行
cscript // nologo c:\ Inetpub\AdminScripts\adsutil.vbs GET/W3SVC/1/ROOT/MyApplication/NTAuthenticationProviders
但这会回来
Error Trying To GET the property: (Get Method Failed)
NTAuthenticationProviders (This property is probably not allowed at this node)
Run Code Online (Sandbox Code Playgroud)
是否无法NTAuthenticationProviders
在应用程序级别设置Metabase属性?
我对在IIS服务器上使用隔离存储感到有点困惑.
我理解隔离存储的目标:提供一个存储数据的安全位置,而不用担心这个地方的方式和位置.
由于隔离存储具有按用户和按组件方法,因此在应用程序几乎具有自己身份的IIS服务器上使用它并不太疯狂.我还没有真正看到模仿Web应用程序的兴趣,而且我自己几乎从未见过模拟的Web应用程序,但这是我的观点.
在服务器上使用独立存储意味着(对于Windows Server 2003):
使用隔离存储 \Documents and Settings\<user>\
这意味着\Documents and Settings\Default User\
当应用程序池是由拥有本地系统或网络服务我猜
这也意味着对本地系统或网络服务的此文件夹具有写权限
使用模仿
关于Web应用程序(逻辑),这些想法让我感到困惑......文档和设置?默认用户?是否只为存储启用模拟?无法控制服务器上的存储?呃?
MSDN上的一些要点:
服务器存储.服务器应用程序可以使用独立存储来提供单独的存储[...].由于隔离存储始终由用户隔离,因此服务器必须模拟发出请求的用户.[...]
使用独立存储使部分受信任的应用程序能够以计算机安全策略控制的方式存储数据.
默认情况下,从本地计算机(本地网络)运行的代码被授予使用独立存储的权利.我应该了解网络服务吗?我会感到惊讶.在我的IIS服务器(Windows 2003)上并非如此.
然后我是一个困境的前沿:System.IO.Packaging
在Web应用程序中使用(内置隔离存储)或找到替代方案?使用IO.Packaging
意味着您必须启用隔离存储?
我的方法错了吗?我错过了什么 ?
我确切地说我并不特别想在IIS服务器上使用/启用它,我想了解如果在这样的环境中启用它是一个很好的做法.
任何观点都值得赞赏,并且有关"使用IIS哲学的独立存储"的解释可能是一个问题.
谢谢 !
我正在尝试使用restful控制器在laravel 5应用程序中注册用户.
问题是当我在我的商店函数中转储数据时,我只获取csrf令牌,而不是值.
这是我到目前为止所尝试的:
Input::all();
Request::get();
这是我正在执行的代码:
形成
<form class="form-horizontal" method="post" action="/users">
<div class="form-group">
<label for="name" class="col-lg-2 control-label">
Name
</label>
<div class="col-lg-10">
<input type="text" class="form-control" id="name" value="a">
</div>
</div>
<div class="form-group">
<label for="email" class="col-lg-2 control-label">
Email
</label>
<div class="col-lg-10">
<input type="email" class="form-control" id="email" value="a@a.Fr">
</div>
</div>
<div class="form-group">
<label for="password" class="col-lg-2 control-label">
Pw
</label>
<div class="col-lg-10">
<input type="password" class="form-control" id="password">
</div>
</div>
<div class="form-group">
<div class="col-lg-10 col-lg-offset-2">
<button type="reset" class="btn btn-default">Cancel</button>
<button type="submit" class="btn btn-primary">Create</button>
</div>
</div>
<input type="hidden" name="_token" …
Run Code Online (Sandbox Code Playgroud) 我是asp.net的新手.我写了一页asp.net,但是当我运行它时,我得到以下错误.
public partial class Issueofbook: System.Web.UI.Page
{
public Int64 Sid;
protected void Page_Load(object sender, EventArgs e)
{
string Id;
Id = Request.QueryString.Get(0);
if (!(IsPostBack == true))
{
if (Request.QueryString.Get(1) == "G")
{
Sid = Convert.ToInt64(Id);
if (PopulatedRecord (Sid ) == false)
{
}
}
}
}
private Boolean PopulatedRecord(Int64 Id)
{
DataSet DS;
DS = new DataSet();
SqlCommand cmd = new SqlCommand();
SqlDataAdapter da = new SqlDataAdapter();
SqlConnection Cnn = new SqlConnection();
string connectionstring;
connectionstring = @"Datasource=DEVI\SQLEXPRESS;Intial catalog=librarymanagement;Integrated Security=SSPI";
Cnn.ConnectionString …
Run Code Online (Sandbox Code Playgroud) iis ×2
.net ×1
asp.net ×1
c# ×1
file-io ×1
http ×1
iphone ×1
laravel ×1
laravel-5 ×1
php ×1
textreader ×1
textwriter ×1
user-agent ×1