|
hello every body
DO some one have any idea about how to prevent a specific file to be downloaded when i try to download something from the internet.
For example suppose that file name is: Somme.Cs
so when i try to download any kind of package and this package contain the current file name so the download should be stopped.
best regard
dghdfghdfghdfghdgh
|
|
|
|
|
Not possible. An anti virus program could monitor the file system and check files as they come down, and if they can be read, they can be examined for that file and deleted. When I click on 'myfiles.msi', IE has no idea if a specific file is inside that msi, how could it ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
but it can be detected if i have only this file name to download not a package?
if yes plz tell me how can i do this
best regards
dghdfghdfghdfghdgh
|
|
|
|
|
I guess it depends on the context. Do you mean stop any browser from downloading a specific file ? You'd need a plug in for IE and I'm not sure how you'd do it for Firefox, or if it would be possible. Do you mean a browser that's a control in your app ? That would be a lot easier.
I know if I put an IE control in a form, then any IE instance that operates, causes events to fire in my code. For IE, it may be as simple as putting up a form with IE in it and through that, getting events for all browser instances.
Still sounds stupid to me. You want to block a file with a specific name from being downloaded. I think it's clear how easy this would be to defeat, what's the point ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
in ohter words,
i want to create a program or a service and install it in the ISP provider.So when client try to download a non illegal file the ISP prevent the download action.
thanks
dghdfghdfghdfghdgh
|
|
|
|
|
Oh - you never asked this. You want to write something on the ISP end, not on the user end ? That's a lot more doable, for all sorts of reasons, not least, the fact that you can install any program you want there.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
ellllllllie wrote: DO some one have any idea about how to prevent a specific file to be downloaded when i try to download something from the internet.
For example suppose that file name is: Somme.Cs
You would normally limit access to the files using an HttpForbiddenHandler. You add the extensions you want blocking into the httpHandlers section of your local web.config file
:<system.web>
<httpHandlers>
<add verb="*" path="*.cs" type="System.Web.HttpForbiddenHandler" />
</httpHandlers>
</system.web>
|
|
|
|
|
Notice that any file within your web application can be downloaded. A webapplication starts from the root folder and all subfolders where no other application is running.
To prevent certain files to be downloaded you should place them outside your web-application and send them to the visitor when 'access is granted'
for example, your web application is running in :
e:\inetpub\wwwroot\yourwebsite\
All files and folders from e:\inetpub\wwwroot\yourwebsite\ and lower are readable for users (ofcourse depends on folder permissions etc etc, but by default readable)
When you place your files for example in a folder e:\inetpub\wwwroot\upload\ and create a aspx file (for example 'download.aspx') in your website which has access to the e:\inetpub\wwwroot\upload\ path you can make those files available to users. Then you can check in download.aspx wether a visitor is allowed to download the file or not. If not, you show a message like access denied, if so you open the file and send the content to the user.
Don't know if my story is clear, but hope you understand what I mean
|
|
|
|
|
Eduard Keilholz wrote: Notice that any file within your web application can be downloaded.
This isn't true in a properly configured site. If it was true, then this would represent a serious security breach in ASP.NET. Here's a test - try to download the web.config file from an ASP.NET site - you can't do it because the machine.config maps this to an HttpForbiddenHandler.
|
|
|
|
|
Erhm, I didn't think of the HttpForbiddenHandler which may be a better solution, but I don't agree my solution isn't true. If you have a folder on your server having sufficient permissions, you're web application is able to read or (depending on those permissions) even write there.
That way you make file available through a WebForm and not via a direct URL.
Or am I thinking seriously stupid
|
|
|
|
|
You are right that an application could transmit the content back out as a serialized byte stream from any folder (given sufficient access permissions). It's up to the developer to prevent this from happening, and is easy enough to do from the application.
|
|
|
|
|
Helllo everyBody,
Just wanna to say that clients can access any web Page or any website and try to download that file.and then the isp should detect this file and stop it.
best regards
dghdfghdfghdfghdgh
|
|
|
|
|
Eh? Do you mean that you don't want anybody to be able to rip your website? If so, there's no simple way to stop this (and in some cases it's impossible).
|
|
|
|
|
hey plz Mr. O'Hanlon i need ur help.
We have some files that exist in some sites that help some clients to activate my application.
i thaught that if i speak with the isp provider to prevent this persons from downloading this files, it seems a solution to my problem.
Note that i don't have any website.
Some one tell me to use a proxy server and disallow these files from being downloaded.
do you have any suggestion plz?
best regards
dghdfghdfghdfghdgh
|
|
|
|
|
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 21: static MemberPhotoConfiguration()
Line 22: {
Line 23: dbConnectionString = ConfigurationManager.ConnectionStrings["MemberPhotoConnection"].ConnectionString;
Line 24: dbProviderName = ConfigurationManager.ConnectionStrings["MemberPhotoConnection"].ProviderName;
Line 25: productsPerPage = Int32.Parse(ConfigurationManager.AppSettings["ProductsPerPage"]);
Source File: c:\Inetpub\wwwroot\MemberPhoto\App_Code\MemberPhotoConfiguration.cs Line: 23
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
MemberPhotoConfiguration..cctor() in c:\Inetpub\wwwroot\MemberPhoto\App_Code\MemberPhotoConfiguration.cs:23
[TypeInitializationException: The type initializer for 'MemberPhotoConfiguration' threw an exception.]
MemberPhotoConfiguration.get_DbProviderName() in c:\Inetpub\wwwroot\MemberPhoto\App_Code\MemberPhotoConfiguration.cs:45
GenericDataAccess.CreateCommand() in c:\Inetpub\wwwroot\MemberPhoto\App_Code\GenericDataAccess.cs:111
CatalogAccess.GetDepartments() in c:\Inetpub\wwwroot\MemberPhoto\App_Code\CatalogAccess.cs:54
DepartmentsList.Page_Load(Object sender, EventArgs e) in c:\Inetpub\wwwroot\MemberPhoto\UserControls\DepartmentsList.ascx.cs:22
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061
|
|
|
|
|
wsamuel,
Take a read of the guidelines:
http://www.codeproject.com/script/Forums/View.aspx?fid=1649&select=1278604#xx1278604xx[^]
Shouting "Urgent!!Please Help!!" and not making your subject title useful wont get you help.
If you read what the error said, you'd know what it means, something on line 23 is null.
Line 23: dbConnectionString = ConfigurationManager.ConnectionStrings["MemberPhotoConnection"].ConnectionString;
So, check you have created dbConnectionString and that "MemberPhotoConnection" is in the webconfig file.
Regards,
Gareth.
|
|
|
|
|
I'm so sorry. I'm new to here. Thanks for the remind and the help.
|
|
|
|
|
Hi,
I'm trying to run a batch file from my C# windows application.
this is my batch file:
@ECHO OFF
ECHO "GOOD MORNING %1%"
:ASK
SET /P ANSWER="Do you want to continue (y/n) ? "
IF "%ANSWER%" == "y" GOTO PRESS_YES
IF "%ANSWER%" == "Y" GOTO PRESS_YES
IF "%ANSWER%" == "n" GOTO PRESS_NO
IF "%ANSWER%" == "N" GOTO PRESS_NO
GOTO ASK
:PRESS_YES
notepad
:PRESS_NO
exit 1
and this is my c# code:
Process pepprocess = new Process();
pepprocess.StartInfo.FileName = "cmd.exe";
pepprocess.StartInfo.Arguments = "/c helloworld.bat GIDI";
pepprocess.StartInfo.UseShellExecute = false;
pepprocess.StartInfo.RedirectStandardInput = true;
pepprocess.StartInfo.RedirectStandardOutput = true;
pepprocess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
pepprocess.StartInfo.CreateNoWindow = true;
pepprocess.Start();
StreamWriter sw = pepprocess.StandardInput;
StreamReader rd = pepprocess.StandardOutput;
while (!rd.EndOfStream)
{
string line = rd.ReadLine();
richTextBox1.Text = line;
if (line.Contains("?"))
{
sw.WriteLine("y");
}
}
my problem is that when i get to the question line, the process is stuck.
the purpose of my c# program is to show the output of the batch file in a windows form, and get answers from the user and send it back to the batch file.
can anyone help me?
thanks,
Gidi.
|
|
|
|
|
Member 2122963,
I don't have an answer for you, but why are you using batch to just start notepad?, why not just it all in C# ?
Regards,
Gareth.
|
|
|
|
|
Hi
looking at the code, i don't think the problem is the detection of the question or the writeline of "y". to me, it looks like the problem is here:
while (!rd.EndOfStream)
{
change it to
while (!pepprocess.HasExited)
{
if it doesn't help go step by step through the code and look what happens..
greets
m@u
|
|
|
|
|
hi all
i have resolved the problem.here is the code
aspx page
<html xmlns="http://www.w3.org/1999/xhtml" ><br />
<head runat="server"><br />
<title>Untitled Page</title><br />
<script type="text/javascript"><br />
<br />
function SelectAll(id) {<br />
var frm = document.forms[0];<br />
for (i=0;i<frm.elements.length;i++) {<br />
if (frm.elements[i].type == "checkbox") {<br />
frm.elements[i].checked = document.getElementById(id).checked;<br />
}<br />
}<br />
} <br />
</script><br />
</head><br />
<body><br />
<form id="form1" runat="server"><br />
<div><br />
<asp:GridView ID="GridView1" runat="server" Width="400px" AutoGenerateColumns="False" OnRowDataBound="GridView1_RowDataBound"><br />
<Columns><br />
<asp:BoundField DataField="PersonID" HeaderText="PersonID" InsertVisible="False"<br />
ReadOnly="True" /><br />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" /><br />
<asp:TemplateField><br />
<%--<AlternatingItemTemplate><br />
<asp:CheckBox ID="CheckBox1" runat="server" /><br />
</AlternatingItemTemplate>--%><br />
<ItemTemplate><br />
<asp:CheckBox ID="CheckBox1" runat="server" /><br />
</ItemTemplate><br />
<HeaderTemplate><br />
<asp:CheckBox ID="cbSelectAll" runat="server" Text="Select All" /><br />
</HeaderTemplate><br />
<HeaderStyle HorizontalAlign="Left" /><br />
<ItemStyle HorizontalAlign="Left" /><br />
</asp:TemplateField><br />
</Columns><br />
</asp:GridView><br />
</div><br />
</form><br />
</body><br />
</html>
code behind
protected void Page_Load(object sender, EventArgs e)
{
BindGrid();
}
private void BindGrid()
{
string Connstr = "connection string";
SqlConnection Conn = new SqlConnection(Connstr);
string str = "select * from emp";
SqlCommand cmd = new SqlCommand(str, Conn);
Conn.Open();
DataSet ds = new DataSet();
SqlDataAdapter Adap = new SqlDataAdapter();
Adap.SelectCommand = cmd;
Adap.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
//adding an attribute for onclick event on the check box in the header
//and passing the ClientID of the Select All checkbox
((CheckBox)e.Row.FindControl("cbSelectAll")).Attributes.Add("onclick", "javascript:SelectAll('" + ((CheckBox)e.Row.FindControl("cbSelectAll")).ClientID + "')");
}
}
pintoo
|
|
|
|
|
Hi Chithra,
What is the problem? Please explain the problem.
|
|
|
|
|
have a look into my last post(posted 24th march).it is in the 5th page of c# message board.
pintoo
|
|
|
|
|
what is the question
|
|
|
|
|
I've two tables and while insertion I've to face lazy response. The query takes much time to insert record. Any suggestion is welcomed. I'm usiing SQL Server 2000.
Thanks
Syed Shahid Hussain
|
|
|
|