filestream

SQL Server 2008 filestream access is denied

删除回忆录丶 提交于 2019-12-10 20:41:41
问题 Can someone help with an Access is denied error message received when attempting to insert FILESTREAM data into SQL Server 2008? I have an ASP.NET application running within an application pool configured with an application-specific user. The web.config uses integrated security... <connectionStrings> <add name="MyApp" connectionString="Data Source=localhost;Initial Catalog=MyDatabase;Integrated Security=SSPI;" providerName="System.Data.SqlClient" /> </connectionStrings> The application's

Overwrite existing XML file if it alreadly exists

点点圈 提交于 2019-12-10 18:45:59
问题 I am trying to overwrite an existing xml file if it already exists. I am using the code below to check if the file exists and then overwrite it if it does. The existing file is hidden so I am unhiding it before attempting to overwrite. The changes are not occuring to the file and the overwriting is not working however. Here is the code I am using below minus the part where I am writing the new xml data. if(File.Exists(filePath)) { File.SetAttributes(filePath,FileAttributes.Normal);

Creating a file with FileStream returns an InvalidOperationException

血红的双手。 提交于 2019-12-10 18:20:47
问题 It returns the exception specifically at line 12 . public void saveToXML() { URL newURL = new URL(); newURL.type = type; newURL.name = name; newURL.info = info; newURL.url = url; newURL.isProtected = isProtected; newURL.amountOfClicks = amountOfClicks; XmlSerializer xml = new XmlSerializer(typeof(URL)); string directory = @"C:\Users\PC-User\Documents\Link" + newURL.name + ".xml"; using (var file = File.Create(directory)) { xml.Serialize(file, url); } } More details in exception message if

FileStream adding “extra” characters to TXT file

守給你的承諾、 提交于 2019-12-10 18:18:10
问题 It does not matter if I read a TXT file or a XML file I always see "extra" info added into my file which is saved to disk. We first do the following: FileStream fs = new FileStream(fileMoverFile.SourcePath, FileMode.Open, FileAccess.Read); Then we assign fs to a variable of type Stream which we pass to the function below: private void SaveToDisk(Stream fileStream, string saveToPath) { if (!Directory.Exists(Path.GetDirectoryName(saveToPath))) { Directory.CreateDirectory(Path.GetDirectoryName

StreamWriter not creating new file

安稳与你 提交于 2019-12-10 17:46:59
问题 I'm trying to create a new log file every hour with the following code running on a server. The first log file of the day is being created and written to fine, but no further log files that day get created. Any ideas what might be going wrong? No exceptions are thrown either. private void LogMessage(Message msg) { string name = _logDirectory + DateTime.Today.ToString("yyyyMMddHH") + ".txt"; using (StreamWriter sw = File.AppendText(name)) { sw.WriteLine(msg.ToString()); } } 回答1: The use of

Silverlight 4.0 FileStream

回眸只為那壹抹淺笑 提交于 2019-12-10 17:32:32
问题 FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read); Arguments: << path >> Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.41108.0&File=mscorlib.dll&Key=FileSecurityState_OperationNotPermitted The line of code above has an error [FileSecurityState_OperationNotPermitted] 回答1: It sounds like your application is running in

Fprintf VS _ftprintf

拈花ヽ惹草 提交于 2019-12-10 16:01:31
问题 both have almost same input parameters: int _ftprintf( FILE *stream, const _tchar *format [, argument ]...) int fprintf(FILE *stream, const char *format, ...) What is the difference between the two format agruments? When should I use each? 回答1: _tprintf and _ftprintf are to be used with TCHAR format strings. TCHAR is just a macro, which unwraps into either char or wchar_t , depending on whether is the _UNICODE macro defined. So, basically, if you don't have _UNICODE defined, _ftprintf will be

Copy file from remote server to client browser via my server without writing the entire file to disk or memory

☆樱花仙子☆ 提交于 2019-12-10 15:34:08
问题 This is the scenario. There is a file on a remote file server (say I have a file hosted on DropBox) I want to offer that file as a download on my web application (c# asp.net 4.0) I want to hide the location 100% of the original file (I want it to appear to come from my sever). I do not want to write this file to memory or to disk on my server. I had assumed that I would want to use a stream to stream copy. example Stream inputStream = response.GetResponseStream(); inputStream.CopyTo(Response

SQL Server 2008 FileStream vs Normal Files

落花浮王杯 提交于 2019-12-10 15:05:49
问题 I am creating an application like youtube to store videos and I need some advice. Should I use SQL Server FileStream to store the video files or should I store them somewhere on the hard disk and record the path as a varchar(MAX) inside SQL Server? Which is recommended and why? Do you recommend something else apart from both these? Please feel free to tell me but please tell me why too. Thank you so much. 回答1: The FILESREAM type has the advantage of providing transparent transactions while

How to get the stream for a Multipart file in webapi upload?

自闭症网瘾萝莉.ら 提交于 2019-12-10 15:05:26
问题 I need to upload a file using Stream (Azure Blobstorage), and just cannot find out how to get the stream from the object itself. See code below. I'm new to the WebAPI and have used some examples. I'm getting the files and filedata, but it's not correct type for my methods to upload it. Therefore, I need to get or convert it into a normal Stream, which seems a bit hard at the moment :) I know I need to use ReadAsStreamAsync().Result in some way, but it crashes in the foreach loop since I'm