473,407 Members | 2,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

about deploying

Hello!

I have a simple application from a book where the actual applications
permission doesn't match the permission referenced from the book.
My question is written further down.
The book is saying the following : "The calculate permission button from the
security properties of Visual Studio analysis is
an application manifest that includes all required permissions. With Visual
Studio 2005, you can see the
application manifest with the name app.manifest below Properties in the
Solution Explorer. The content of this file is shown
here. The XML element <applicationRequestMinimumdefines all required
permissions of the application.
The FileIOPermission is required because the application reads and writes
files using classes from System.IO namaspace."

Below is a copy of app.manifest.
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0"
xmlns="urn:schemas-microsoft-com:asm.v1"
xmlns:asmv1="urn:schemas-microsoft-com:asm.v1"
xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<applicationRequestMinimum>
<defaultAssemblyRequest permissionSetReference="Custom" />
<PermissionSet class="System.Security.PermissionSet" version="1"
ID="Custom" SameSite="site">
<IPermission
class="System.Security.Permissions.ReflectionPermi ssion, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1" Unrestricted="true" />
<IPermission
class="System.Security.Permissions.SecurityPermiss ion, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1" Flags="UnmanagedCode, Execution, ControlEvidence" />
<IPermission class="System.Security.Permissions.UIPermission,
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1" Unrestricted="true" />
<IPermission
class="System.Security.Permissions.KeyContainerPer mission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1" Unrestricted="true" />
</PermissionSet>
</applicationRequestMinimum>
</security>
</trustInfo>
</asmv1:assembly>
Below is the main class and as you can see I use file IO operation so the
application needs the FileIOPermission.
Now to my question: When I click on the "calculate Permission" button in the
sequrity after choosing the property for the
project the FileIOPermission is not selected as a requirement for the
application but according to the book the appliaction
needs this requirement and I must agree with the book in this case.

Can anyone explain the reason why the sequrity button named calculate
permission doesn't include FileIOPermission for
the application as a permission requirement ?

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.IO;
using System.Windows.Forms;
using System.Drawing.Printing;

namespace SimpleEditor
{
public partial class SimpleEditorForm : Form
{
private string filename = "Untitled";
private string[] lines;
private int linesPrinted;
private Brush printBrush;

public SimpleEditorForm() //User defined C-tor
{ InitializeComponent(); }

protected void OpenFile()
{
try
{
textBoxEdit.Clear();
textBoxEdit.Text = File.ReadAllText(filename);
}
catch(IOException ex)
{
MessageBox.Show(ex.Message, "Simple Editor",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}

private void OnFileNew(object sender, EventArgs e)
{
filename = "Untitled";
SetFormTitle();
textBoxEdit.Clear(); // clear textbox
}

private void OnFileOpen(object sender, EventArgs e)
{
if (dlgOpenFile.ShowDialog() == DialogResult.OK)
{
filename = dlgOpenFile.FileName;
SetFormTitle();
OpenFile();
}
}

private void OnFileSave(object sender, EventArgs e)
{
if (filename == "Untitled")
OnFileSaveAs(sender, e);
else
SaveFile();

}

private void OnFileSaveAs(object sender, EventArgs e)
{
if (dlgSaveFile.ShowDialog() == DialogResult.OK)
{
filename = dlgSaveFile.FileName;
SetFormTitle();
SaveFile();
}
}

private void SaveFile()
{
try
{
File.WriteAllText(filename, this.textBoxEdit.Text);
}
catch(IOException ex)
{
MessageBox.Show(ex.Message, "Simple Editor",
MessageBoxButtons.AbortRetryIgnore,MessageBoxIcon. Hand);
}
}

protected void SetFormTitle()
{
Text = new FileInfo(filename).Name + "- Simple Editor";
}

private void OnFilePrint(object sender, EventArgs e)
{
if (this.textBoxEdit.SelectedText != "")
dlgPrint.AllowSelection = true;

if (dlgPrint.ShowDialog() == DialogResult.OK)
printDocument.Print();
}

private void OnFilePrintPreview(object sender, EventArgs e)
{ dlgPrintPreview.ShowDialog(); }

private void OnFilePageSetup(object sender, EventArgs e)
{ dlgPageSetup.ShowDialog(); }

private void OnExit(object sender, EventArgs e)
{ Application.Exit(); }

private void OnPrintPage(object sender, PrintPageEventArgs e)
{
int x = e.MarginBounds.Left;
int y = e.MarginBounds.Top;

while (linesPrinted < lines.Length) //antal rader att printa
{
e.Graphics.DrawString(lines[linesPrinted++],
this.fontDialog.Font, printBrush, x, y);
y += textBoxEdit.Font.Height;

if (y >= e.MarginBounds.Bottom)
{
e.HasMorePages = true;
return;
}
}
}

private void OnBeginPrint(object sender, PrintEventArgs e)
{
char[] param = { '\n' };

if (dlgPrint.PrinterSettings.PrintRange == PrintRange.Selection)
lines = textBoxEdit.SelectedText.Split(param);
else
lines = textBoxEdit.Text.Split(param);

//int i = 0;
//char[] trimParam = { '\r' };

//foreach (string s in lines)
// lines[i++] = s.TrimEnd(trimParam);
if (this.dlgPrint.PrinterSettings.SupportsColor)
printBrush = new SolidBrush(textBoxEdit.ForeColor);
else
printBrush = Brushes.Black;
}

private void OnEndPrint(object sender, PrintEventArgs e)
{ lines = null; }
private void fontToolStripMenuItem_Click(object sender, EventArgs e)
{
if (fontDialog.ShowDialog() == DialogResult.OK)
textBoxEdit.Font = fontDialog.Font;
}

private void colorToolStripMenuItem_Click(object sender, EventArgs
e)
{
if (colorDialog.ShowDialog() == DialogResult.OK)
textBoxEdit.ForeColor = colorDialog.Color;
}
}
}

//Tony
Jul 21 '08 #1
0 1142

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Sean Campbell | last post by:
Hi, My group have a ASP.NET based application ( currently running on 1.0.3705 ). Ideally, we would like to deploy new components(asp files/assemblies/db updates) into a live environment without...
1
by: Terry H | last post by:
Hi I am deploying a winforms app via the windows installer and a VS.Net 2003 setup and deploymnet project. At the moment, I am adding launch conditions for the .Net Framework 1.1 and MDAC 2.7...
1
by: dansan | last post by:
We have a webservice that we have been deploying using the deployment project in Visual Studio. Now we are trying to deploy this service to a server that has multiple sites. I have looked...
2
by: Flip | last post by:
I am deploying webapps using XP (IIS5) and deploying them to a Windows 2003 Server box (IIS6). So far so good. However, when I try to manage my w2k3 server from XP, I get an error message saying...
3
by: Rachel | last post by:
Hi, I am using the data access application block successfully in our development environment, however when I deploy to our testing server as Private Assemblies I keep getting the following ...
4
by: john | last post by:
I think some of the changes to Asp.net are rediculous. Take the ability to deploy source code to production that is compiled on the fly. If this is such a great model, why not distribute your...
1
by: Jeff | last post by:
Hey I've installed DotNetNuke Starter Kit (4.3.4) together with visual web developer 2005 express on my development computer So now I'm able to create DotNetNuke portals using vwd. But this...
6
by: milind | last post by:
tell more about .net framework EggHeadCafe.com - .NET Developer Portal of Choice http://www.eggheadcafe.com
1
by: =?Utf-8?B?d2lsbGlhbQ==?= | last post by:
Hi All, I've seen a lot of articles which show you how to deploy asp.net web application and web service, but all of them deploy application/web service under default folder virtual directory....
5
by: RobinS | last post by:
My company is considering moving up from .Net 2.0 to .Net 3.5(SP1) as a prerequisite on the ClickOnce deployment for our application. Does anybody have any experience deploying .Net 3.5 either as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.