Showing posts with label files. Show all posts
Showing posts with label files. Show all posts

Wednesday, March 28, 2012

The best way to create graphics files for import

Hello!
I want to use a graphics editor and create some luxurious images with a
graphics package that integrates with Visual Studio. I looked at Macromedia
MX, and Fireworks. Any suggestions?
SpencerI seem to recall that Adobe makes such a product for integration with .Net
apps. Can't remember the name offhand.
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
Ambiguity has a certain quality to it.
"Spencer H. Prue" <SpencerHPrue@dotnet.itags.org.discussions.microsoft.com> wrote in message
news:311189CE-3D02-4DCB-AC7F-9AB2C098FFB0@dotnet.itags.org.microsoft.com...
> Hello!
> I want to use a graphics editor and create some luxurious images with a
> graphics package that integrates with Visual Studio. I looked at
> Macromedia
> MX, and Fireworks. Any suggestions?
>
>
>
> --
> Spencer

The best way to create graphics files for import

Hello!

I want to use a graphics editor and create some luxurious images with a
graphics package that integrates with Visual Studio. I looked at Macromedia
MX, and Fireworks. Any suggestions?

--
SpencerI seem to recall that Adobe makes such a product for integration with .Net
apps. Can't remember the name offhand.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"Spencer H. Prue" <SpencerHPrue@dotnet.itags.org.discussions.microsoft.com> wrote in message
news:311189CE-3D02-4DCB-AC7F-9AB2C098FFB0@dotnet.itags.org.microsoft.com...
> Hello!
> I want to use a graphics editor and create some luxurious images with a
> graphics package that integrates with Visual Studio. I looked at
> Macromedia
> MX, and Fireworks. Any suggestions?
>
>
>
> --
> Spencer

Saturday, March 24, 2012

the directory is not allowed because the application is precompiled

Hi,

have only precompiled version of application as original files have been
lost. Trying to alter application in Visual Web Developer but error message
reads

"the directory is not allowed because the application is precompiled"

Can anyone help, thanks in advance.

Simon Garehave you tried creating a new project and importing the old files? That
probably won't work but might be worth trying. If i remember correctly
the precompiled site gets rid of the codebehinds and compiles
everything into the dll's.

Simon Gare wrote:

Quote:

Originally Posted by

Hi,
>
have only precompiled version of application as original files have been
lost. Trying to alter application in Visual Web Developer but error message
reads
>
"the directory is not allowed because the application is precompiled"
>
Can anyone help, thanks in advance.
>
Simon Gare


"Simon Gare" <sg@.simongare.comwrote in message
news:%23j3iWszqGHA.4192@.TK2MSFTNGP04.phx.gbl...
if you have an App_Code directory, delete it, because all of the content are
already compiled in the dll's.

Quote:

Originally Posted by

Hi,
>
have only precompiled version of application as original files have been
lost. Trying to alter application in Visual Web Developer but error
message
reads
>
"the directory is not allowed because the application is precompiled"
>
Can anyone help, thanks in advance.
>
Simon Gare
>
>

The element html occurs too few times.

I am using Beta 2 and have a problem with aspx files in that it is refusing to compile unless I have a top level HTML element. The problem with this is that I do not want to define the top level html in the aspx page, I want to define it in a usercontrol and then load that dynamically at runtime just as I can in ASP.NET 1.1. Surely there are other reasons you would want to have an aspx page without an <html> tag in it, I can think of several, why is there this limitation as it severly limits flexibility.
It says "The element 'html' occurs too few times."
Is there anyway to turn off this error to get it to compile?
Richard
"Surely there are other reasons you would want to have an aspx page without an <html> tag in it"
Like when? an aspx page is goign to spit out an HTML document, so the <html> tag makes perfect sense
Sounds like you have your programming all backwards, the aspx page should have the shell and the user controls should have the dynamic content, not the other way around
Like for example when you are trying to output WAP content for one, or plain text for another.
This is because I need to be able to easily substitute the head sections primarily dynamically, this enables multiple sites to run on the same codebase looking for Host headers to load the appropriate templates, it also allows easy support for text only versions of sites, just by dynamically loading text only versions of the user controls, this is for a database driven website content managed system.
Ive looked into master pages but they dont seem to really allow enough flexibility to do what I need to do as they require the definition of the whole document in them, but maybe ill have to work out some way to fudge it with those.
Im not sure what you are refering to about doing it backwards, the aspx page is the shell that loads up the user controls, and the user controls are what contain the dynamic content.
Hello.
Are you also removing the <head> section from the page? I've noticed in the past that if you remove the <html> tag but leave the <head runat="server"> you'll get that errror when you build the project in VS.
one more thing: you can use "filters" to apply different master pages to different browsers. for instance:

<%@.PageLanguage="C#"ie:MasterPageFile="~/Cap14/IE.master"MasterPageFile="~/Cap14/Mozilla.master"%>
applies a master page to IE and another to the other browsers. Check your browsers files to see the IDs of the browsers... oh, and you can alsouse adapters to render your pages/controls according to your needs in different browsers...


I don't think missing <html> element is an error. It is HTML markup validation message and is supposed to be a warning. Does it really break compilation or the page still runs? You can deal with the message in a few ways. First, you can disable validation in Tools | Options | Text Editor | HTML | Validation. Second, you can edit validation schema in Program Files\...\Common7\Packages\schemas\html (IE6_0.xsd, for example) and delete minOccurs="1" maxOccurs="1" from the <xsd:element name="html" >. Third, instead of using ASPX page, you can define your own file type, add it to the web.config and implement a handler for the type that will generate the response programmatically.

Giving it a fuller test it doesnt seem to break compilation on its own, I was getting other compilation errors too which were actually stopping it, but it does get reported as an error rather than a warning along with the other errors leading you to believe it is stopping compilation and needs to be fixed before you can compile.


I say just ignore it. If you are making an XML page, you can't have the <html> tag, for instance. So, just ignore it. That's what I do.

Thursday, March 22, 2012

The file exist but cant delete on server (c#)

Hi all, have an c# page that allows users to uploaded files to the server. I was hoping to also hoping to allow users to delete files aswell. I have the following code, but it dose no delete the file, even though it can find the file (the response.write outputs). Here is my code:

if(File.Exists(sPhysicalPath + @dotnet.itags.org."\" + sOrgFileName)){
Response.Write("delete");
File.Delete(sPhysicalPath + @dotnet.itags.org."" + sOrgFileName);
}

Any suggestions appreciated.

Thanks,

Hi,

by default, and for security reasons, ASP.NET doesn't have the privileges to perform IO actions like deleting a file. You can create a new windows user account that has the same privileges as the ASP.NET account and augment it with the needed privileges to delete certain files on the disk. After that you can impersonate your application with that new account by setting, in the web.config of your application, the<identity impersonate="true" userName="yournewaccount" />

Grz, Kris.

The file system has let me down (writing XML directly to the DB)

After months of trying to track down a bug where, randomly, on rare
occasions, our XML files only get half-written from our application, we're
throwing up our hands and moving it into the DB.

So, instead of writing our XML files to the filesystem, I'm just going to
send the XML straight to a field in the DB and just grab it from there when
needed.

I have a few questions regarding that:

- preferred method? Right now, I'm using a FileStream:

Dim fs As New
System.IO.FileStream(System.Web.HttpContext.Curren t.Server.MapPath("/mjb05/rulesXML/"
& Trim(DS.Tables(0).Rows(rowCount)("filename").ToString) & ".xml"),
IO.FileMode.Create, IO.FileAccess.Write, IO.FileShare.Read)

If I'm going to send the text string right to the DB, what should I be
using? Stringbuilder and then just pass the XMLwriter to that?

- caching

One reason we liked the XML was that the server could easily cache it (we
access the XML on each page of our site). And the cache would only update
when the file was updated. If we store it in the database, we'd have to do a
query to see if it's been updated. Is that a big deal? Should we just cache
it every 5 minutes or so? Other preferred method?

-Darrel

--
================================================== ===============
Win prizes searching google:
http://www.blingo.com/friends?ref=h...FnTqhv-2GE1FNtAThus wrote darrel,

> After months of trying to track down a bug where, randomly, on rare
> occasions, our XML files only get half-written from our application,
> we're throwing up our hands and moving it into the DB.
> So, instead of writing our XML files to the filesystem, I'm just going
> to send the XML straight to a field in the DB and just grab it from
> there when needed.
> I have a few questions regarding that:
> - preferred method? Right now, I'm using a FileStream:
> Dim fs As New
> System.IO.FileStream(System.Web.HttpContext.Curren t.Server.MapPath("/m
> jb05/rulesXML/" &
> Trim(DS.Tables(0).Rows(rowCount)("filename").ToString) & ".xml"),
> IO.FileMode.Create, IO.FileAccess.Write, IO.FileShare.Read)
> If I'm going to send the text string right to the DB, what should I be
> using? Stringbuilder and then just pass the XMLwriter to that?

If your database has a native XML datatype and it's supported by its ADO.NET
provider, I'd use that -- one example is SQL Server (Express) 2005. You can
also get away using CLOBs or BLOBs if you don't care about the XML content
at database level (i.e. don't need to search within an XML document). That
should work with any old database.

> - caching
> One reason we liked the XML was that the server could easily cache it
> (we access the XML on each page of our site). And the cache would only
> update when the file was updated. If we store it in the database, we'd
> have to do a query to see if it's been updated. Is that a big deal?
> Should we just cache it every 5 minutes or so? Other preferred method?

Again, SQL Server 2005 comes to the rescue. Using a SqlCacheDependency, you
can easily implement an automatic refresh of your cached objects. See http://msdn.microsoft.com/library/d...otification.asp.

You can also emulate this feature using database triggers in other databases.

Cheers,
--
Joerg Jooss
news-reply@.joergjooss.de

The file system has let me down (writing XML directly to the DB)

After months of trying to track down a bug where, randomly, on rare
occasions, our XML files only get half-written from our application, we're
throwing up our hands and moving it into the DB.
So, instead of writing our XML files to the filesystem, I'm just going to
send the XML straight to a field in the DB and just grab it from there when
needed.
I have a few questions regarding that:
- preferred method? Right now, I'm using a FileStream:
Dim fs As New
System.IO.FileStream(System.Web.HttpContext.Current.Server.MapPath("/mjb05/r
ulesXML/"
& Trim(DS.Tables(0).Rows(rowCount)("filename").ToString) & ".xml"),
IO.FileMode.Create, IO.FileAccess.Write, IO.FileShare.Read)
If I'm going to send the text string right to the DB, what should I be
using? Stringbuilder and then just pass the XMLwriter to that?
- caching
One reason we liked the XML was that the server could easily cache it (we
access the XML on each page of our site). And the cache would only update
when the file was updated. If we store it in the database, we'd have to do a
query to see if it's been updated. Is that a big deal? Should we just cache
it every 5 minutes or so? Other preferred method?
-Darrel
========================================
=========================
Win prizes searching google:
http://www.blingo.com/friends?ref=h...FnTqhv-2GE1FNtAThus wrote darrel,

> After months of trying to track down a bug where, randomly, on rare
> occasions, our XML files only get half-written from our application,
> we're throwing up our hands and moving it into the DB.
> So, instead of writing our XML files to the filesystem, I'm just going
> to send the XML straight to a field in the DB and just grab it from
> there when needed.
> I have a few questions regarding that:
> - preferred method? Right now, I'm using a FileStream:
> Dim fs As New
> System.IO.FileStream(System.Web.HttpContext.Current.Server.MapPath("/m
> jb05/rulesXML/" &
> Trim(DS.Tables(0).Rows(rowCount)("filename").ToString) & ".xml"),
> IO.FileMode.Create, IO.FileAccess.Write, IO.FileShare.Read)
> If I'm going to send the text string right to the DB, what should I be
> using? Stringbuilder and then just pass the XMLwriter to that?
If your database has a native XML datatype and it's supported by its ADO.NET
provider, I'd use that -- one example is SQL Server (Express) 2005. You can
also get away using CLOBs or BLOBs if you don't care about the XML content
at database level (i.e. don't need to search within an XML document). That
should work with any old database.

> - caching
> One reason we liked the XML was that the server could easily cache it
> (we access the XML on each page of our site). And the cache would only
> update when the file was updated. If we store it in the database, we'd
> have to do a query to see if it's been updated. Is that a big deal?
> Should we just cache it every 5 minutes or so? Other preferred method?
Again, SQL Server 2005 comes to the rescue. Using a SqlCacheDependency, you
can easily implement an automatic refresh of your cached objects. See http://msdn.
microsoft.com/l...on
.asp.
You can also emulate this feature using database triggers in other databases
.
Cheers,
--
Joerg Jooss
news-reply@.joergjooss.de

The files are downloaded with the html code at the end of them

I have a code that download files form a folder to the client:

Try
Response.AddHeader("Content-Disposition", "attachment;filename=" & strFileName)
Dim fs As FileStream = New FileStream("C:\text.txt", FileMode.Open, FileAccess.Read)
Dim fileData As Byte()
ReDim fileData(fs.Length)
Dim bytesRead As Long = fs.Read(fileData, 0, CInt(fs.Length))
fs.Close()
Response.BinaryWrite(fileData)
Catch es as Exception
lblAlert.text = "It was a problem transferring the file."
end try

The problem is that if you open the files with 'notepad' you see that the html code of the page has been incorporated to the end of the file. Something like this:

***************Beginning of the file***************
0000114099 00000 n
0000114243 00000 n
0000114317 00000 n
trailer<</Size 62/ID<79e93880650e9d343ab0837ab878f5cd><79e93880650e9d343ab0837ab878f5cd>]>>
startxref 173 %%EOF
<html>
<head>
<title>HLC Intranet - HLC Eroom</title>
***************rest of the html code***************

Somebody knows what can be? How can I takeout the html code?

Thanks,

BriegaHi,

I presume this is some code-behind code. Check if there is still some html code in your page (this is created automatically when you create a new webform in vs.net). Delete the html code and only leave the Page-directive.

I struggled with this issue also last year and this is what worked for me:


Response.Clear()
Response.ContentType = scan.ContentType
Response.BinaryWrite(scan.Document)
Response.End()

Grz, Kris.
It works!!!

The only part of your code that I don't understand is the


Response.BinaryWrite(scan.Document)

Could you tell me what that does? I've copy the code without it and it works anyway.

Regards,

Briega
Sorry I typed wrong!

What I don't understand is:


Response.ContentType = scan.ContentType

Briega
I'm sorry, I took a little snippet out of my code. scan is an instantiation of a custom made class which retrieves the binary data and it's accompanying contenttype (pdft, excell, word, ...)

You can search for the content types on the internet.

Grz, Kris.