Showing posts with label directly. Show all posts
Showing posts with label directly. Show all posts

Monday, March 26, 2012

Permission

Hey Guys...
I've created my SmartClient that have to print some text directly to the
printer. To do it, I create a text file and after copy it to the printer.
Perfect... But, I am having some permission problems... Look the error:
The application tried to execute a not permited operation by the security
directive ...
System.Drawing.PrintingPermission, System.Drawing.Version=...
Could someone help me?
Thank'sHi,
I think i already send you chris sells article. you can find your
solution there :
http://msdn.microsoft.com/library/d...y/en-us/dnforms
/html/winforms11122002.asp
and
http://msdn.microsoft.com/msdnmag/i...etSmartClients/
HTH
Natty Gur[MVP]
blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!

Permission

Hey Guys...

I've created my SmartClient that have to print some text directly to the
printer. To do it, I create a text file and after copy it to the printer.
Perfect... But, I am having some permission problems... Look the error:

The application tried to execute a not permited operation by the security
directive ...

System.Drawing.PrintingPermission, System.Drawing.Version=...

Could someone help me?

Thank'sHi,

I think i already send you chris sells article. you can find your
solution there :

http://msdn.microsoft.com/library/d...y/en-us/dnforms
/html/winforms11122002.asp

and

http://msdn.microsoft.com/msdnmag/i...etSmartClients/

HTH

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Saturday, March 24, 2012

Permission Problem writing to Disk in Asp.NET application

Here's what I need to do:
Due to a bug in Crystal Reports ExportToStream() method I can't stream a
Crystal Reports directly to the client as PDF and I must must use the
Export() and put the the PDF on disk first and stream to the client. That's
just how it is.

Question:
So I need to let the aspx user have write permissions to disk.. NOT GOOD.
How do I solve this? Can I somehow write the PDF to disk in another thread
with other writes? OR are ther other ways around this?

best regards
/Lars NetzelLars

Note : The code below is stripped from a asp.net project using a web
service. This project would relay a binary file from an internal web server
where Crystal reports is installed to an external web server. You will still
need write permissions for the directory you want to save to

You could try this, I hope It helps

Stream fs =
rep.ExportToStream(CrystalDecisions.Shared.ExportF ormatType.PortableDocFormat);
byte[] binaryfile = StreamToBinary(fs);
string docLocation = Server.MapPath(null) + @."\Docs\";
SaveFileToServer(binaryfile,docLocation,"my.pdf",DateTime.Now);
Response.Redirect("Docs/"+"my.pdf");

public void SaveFileToServer(byte[] binaryFile, string docPath, string
docName, DateTime fileModifiedDate)
{
Directory.CreateDirectory(docPath);
MemoryStream m = new MemoryStream(binaryFile);
FileStream f = new FileStream(docPath+docName,FileMode.Create);
m.WriteTo(f);
f.Close();
m.Close();
File.SetLastWriteTime(docPath+docName,fileModified Date);
}

public byte[] StreamToBinary(Stream fs)
{
Int32 i = Convert.ToInt32(fs.Length);
byte[] b = new byte[fs.Length];
fs.Read(b,0,i);
fs.Close();
}

"Lars Netzel" <lars.netzel@.NO-SPAM.qlogic.se> wrote in message
news:%23wlKhu8HFHA.3244@.TK2MSFTNGP09.phx.gbl...
> Here's what I need to do:
> Due to a bug in Crystal Reports ExportToStream() method I can't stream a
> Crystal Reports directly to the client as PDF and I must must use the
> Export() and put the the PDF on disk first and stream to the client.
> That's just how it is.
> Question:
> So I need to let the aspx user have write permissions to disk.. NOT GOOD.
> How do I solve this? Can I somehow write the PDF to disk in another thread
> with other writes? OR are ther other ways around this?
> best regards
> /Lars Netzel
Thanks but I can't ExportToStream due to a bug with record and
groupselections in the Crystal Reports Engine. so I can't use that code.

I need to write to disk with other permisisons than the ASPNET user

/Lars

"Kamal Vaghjiani" <kamal@.mortgageuk.com> wrote in message
news:Ok7aI59HFHA.2784@.TK2MSFTNGP09.phx.gbl...
> Lars
> Note : The code below is stripped from a asp.net project using a web
> service. This project would relay a binary file from an internal web
> server where Crystal reports is installed to an external web server. You
> will still need write permissions for the directory you want to save to
> You could try this, I hope It helps
> Stream fs =
> rep.ExportToStream(CrystalDecisions.Shared.ExportF ormatType.PortableDocFormat);
> byte[] binaryfile = StreamToBinary(fs);
> string docLocation = Server.MapPath(null) + @."\Docs\";
> SaveFileToServer(binaryfile,docLocation,"my.pdf",DateTime.Now);
> Response.Redirect("Docs/"+"my.pdf");
> public void SaveFileToServer(byte[] binaryFile, string docPath, string
> docName, DateTime fileModifiedDate)
> {
> Directory.CreateDirectory(docPath);
> MemoryStream m = new MemoryStream(binaryFile);
> FileStream f = new FileStream(docPath+docName,FileMode.Create);
> m.WriteTo(f);
> f.Close();
> m.Close();
> File.SetLastWriteTime(docPath+docName,fileModified Date);
> }
> public byte[] StreamToBinary(Stream fs)
> {
> Int32 i = Convert.ToInt32(fs.Length);
> byte[] b = new byte[fs.Length];
> fs.Read(b,0,i);
> fs.Close();
> }
>
> "Lars Netzel" <lars.netzel@.NO-SPAM.qlogic.se> wrote in message
> news:%23wlKhu8HFHA.3244@.TK2MSFTNGP09.phx.gbl...
>> Here's what I need to do:
>> Due to a bug in Crystal Reports ExportToStream() method I can't stream a
>> Crystal Reports directly to the client as PDF and I must must use the
>> Export() and put the the PDF on disk first and stream to the client.
>> That's just how it is.
>>
>> Question:
>> So I need to let the aspx user have write permissions to disk.. NOT GOOD.
>> How do I solve this? Can I somehow write the PDF to disk in another
>> thread with other writes? OR are ther other ways around this?
>>
>> best regards
>> /Lars Netzel
>>

Permission Problem writing to Disk in Asp.NET application

Here's what I need to do:
Due to a bug in Crystal Reports ExportToStream() method I can't stream a
Crystal Reports directly to the client as PDF and I must must use the
Export() and put the the PDF on disk first and stream to the client. That's
just how it is.
Question:
So I need to let the aspx user have write permissions to disk.. NOT GOOD.
How do I solve this? Can I somehow write the PDF to disk in another thread
with other writes? OR are ther other ways around this?
best regards
/Lars NetzelLars
Note : The code below is stripped from a asp.net project using a web
service. This project would relay a binary file from an internal web server
where Crystal reports is installed to an external web server. You will still
need write permissions for the directory you want to save to
You could try this, I hope It helps
Stream fs =
rep.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocForma
t);
byte[] binaryfile = StreamToBinary(fs);
string docLocation = Server.MapPath(null) + @."\Docs\";
SaveFileToServer(binaryfile,docLocation,
"my.pdf",DateTime.Now);
Response.Redirect("Docs/"+"my.pdf");
public void SaveFileToServer(byte[] binaryFile, string docPath, string
docName, DateTime fileModifiedDate)
{
Directory.CreateDirectory(docPath);
MemoryStream m = new MemoryStream(binaryFile);
FileStream f = new FileStream(docPath+docName,FileMode.Create);
m.WriteTo(f);
f.Close();
m.Close();
File. SetLastWriteTime(docPath+docName,fileMod
ifiedDate);
}
public byte[] StreamToBinary(Stream fs)
{
Int32 i = Convert.ToInt32(fs.Length);
byte[] b = new byte[fs.Length];
fs.Read(b,0,i);
fs.Close();
}
"Lars Netzel" <lars.netzel@.NO-SPAM.qlogic.se> wrote in message
news:%23wlKhu8HFHA.3244@.TK2MSFTNGP09.phx.gbl...
> Here's what I need to do:
> Due to a bug in Crystal Reports ExportToStream() method I can't stream a
> Crystal Reports directly to the client as PDF and I must must use the
> Export() and put the the PDF on disk first and stream to the client.
> That's just how it is.
> Question:
> So I need to let the aspx user have write permissions to disk.. NOT GOOD.
> How do I solve this? Can I somehow write the PDF to disk in another thread
> with other writes? OR are ther other ways around this?
> best regards
> /Lars Netzel
>
Thanks but I can't ExportToStream due to a bug with record and
groupselections in the Crystal Reports Engine. so I can't use that code.
I need to write to disk with other permisisons than the ASPNET user
/Lars
"Kamal Vaghjiani" <kamal@.mortgageuk.com> wrote in message
news:Ok7aI59HFHA.2784@.TK2MSFTNGP09.phx.gbl...
> Lars
> Note : The code below is stripped from a asp.net project using a web
> service. This project would relay a binary file from an internal web
> server where Crystal reports is installed to an external web server. You
> will still need write permissions for the directory you want to save to
> You could try this, I hope It helps
> Stream fs =
> rep.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFor
mat);
> byte[] binaryfile = StreamToBinary(fs);
> string docLocation = Server.MapPath(null) + @."\Docs\";
> SaveFileToServer(binaryfile,docLocation,
"my.pdf",DateTime.Now);
> Response.Redirect("Docs/"+"my.pdf");
> public void SaveFileToServer(byte[] binaryFile, string docPath, string
> docName, DateTime fileModifiedDate)
> {
> Directory.CreateDirectory(docPath);
> MemoryStream m = new MemoryStream(binaryFile);
> FileStream f = new FileStream(docPath+docName,FileMode.Create);
> m.WriteTo(f);
> f.Close();
> m.Close();
> File. SetLastWriteTime(docPath+docName,fileMod
ifiedDate);
> }
> public byte[] StreamToBinary(Stream fs)
> {
> Int32 i = Convert.ToInt32(fs.Length);
> byte[] b = new byte[fs.Length];
> fs.Read(b,0,i);
> fs.Close();
> }
>
> "Lars Netzel" <lars.netzel@.NO-SPAM.qlogic.se> wrote in message
> news:%23wlKhu8HFHA.3244@.TK2MSFTNGP09.phx.gbl...
>

Friday, March 16, 2012

Persist DataTable Values

Hi All:

I have a DataTable that I have defined Globally. I populate this datatable
dynamically with file/folder information that I read directly from the
server. I use this datatable information to bind mainly to a DataGrid, but
I would also like it to persist for the duration that I have a particular
page open. I seem to be losing this data either thru postbacks or by the
way I have coded it. Does anyone have any suggestions on how I can keep
this datatable in memory? TIA

--

Best regards

Paul Perot
President
Perot Solutions
perotsolutions@dotnet.itags.org.earthlink.net
(770) 565 - 9151
(678) 852 - 7789 (c)You began by saying that the DataTable is "defined Globally." What does that
mean? Global to what? Obviously, it isn't truly global, or you wouldn't be
asking how to persist it. For example, if it was global to the Application
(in Application Cache, for example), you wouldn't need to persist it in any
other way. It would be truly global.

I only asked that to get you thinking along these lines, hopefully so that
this situation would not rear its ugly head again for you. The issue here is
scope. And a good understanding of ASP.Net scope is what is needed to
resolve it and any future issues of scope that may arise.

I suspect that by "defined Globally" you mean that you declared a variable
with Page scope, that is, defined in your Page class as a Field or Property
of your Page class, not inside a Method. However, the scope of such a
variable is global to only a single Page instance, and each Request for a
Page creates a new Page instance. A PostBack will not see the value of a
variable declared in a previous instance of this Page class, as the variable
will be re-initialized with the initialization of the Page class.

As you've defined the requirement that this variable be global to all
instances of this Page class (within the context of a single initial Request
and the related group of PostBacks), you could declare it as static (Shared
in VB.Net) in the Page class, or, if you want it re-initialized with each
non-PostBack (initial Request), you could put it into the Page's ViewState
or in Session. If you put it into ViewState, the size of it may affect the
time it takes for the Page to load in the browser (ViewState being a hidden
form field in the HTML form). The advantage of ViewState is that the
variable will disappear as soon as a different Page is Requested. If you use
Session, the Page will have to re-initialize the Session value when it is
Requested via non-PostBack (initial Request).

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Paul Perot" <perotsolutions@.earthlink.net> wrote in message
news:CyjCb.332$X97.100@.newsread2.news.atl.earthlin k.net...
> Hi All:
> I have a DataTable that I have defined Globally. I populate this
datatable
> dynamically with file/folder information that I read directly from the
> server. I use this datatable information to bind mainly to a DataGrid,
but
> I would also like it to persist for the duration that I have a particular
> page open. I seem to be losing this data either thru postbacks or by the
> way I have coded it. Does anyone have any suggestions on how I can keep
> this datatable in memory? TIA
> --
> Best regards
> Paul Perot
> President
> Perot Solutions
> perotsolutions@.earthlink.net
> (770) 565 - 9151
> (678) 852 - 7789 (c)