Showing posts with label client. Show all posts
Showing posts with label client. Show all posts

Thursday, March 29, 2012

newbie: I don't want my .aspx and .cs files to have the source viewable by the client

I'm creating a C# .net project, for a client. However they only have the
right to the binaries, not the source code. Is there a way to compile it so
that I just give them dll's? or do they need the .aspx pages. I read
somewhere that I could probably make assemblies (excuse my bad terminology)
of the source code, but that it is quiet easy to disassemble the assemblies,
so that does not seem to afford read protection.
or am I just all over nothing!
thanksYou need to give them the ASPX pages and the compiled DLLs, but you do not
need to give them the .CS source code files.
If they are unethical they could decombile the DLLs to get a rough
approximation of the source code, but you can thwart them with an
Obfuscator.
Visual Studio 2003 has a basic built in obfuscator, but for 2002 you'll need
a 3rd party solution.
Here's more information on obfuscators:
http://www.abderaware.com/WhitePapers/Obfuscator.htm
http://www.preemptive.com/dotfuscator/index.html
http://www.devx.com/SummitDays/Article/11351
http://www.lesser-software.com/ilobf.htm
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Seth Broomer" <asdf@.asdsd.com> wrote in message
news:eWLgn06jEHA.1656@.TK2MSFTNGP09.phx.gbl...
> I'm creating a C# .net project, for a client. However they only have the
> right to the binaries, not the source code. Is there a way to compile it
> so
> that I just give them dll's? or do they need the .aspx pages. I read
> somewhere that I could probably make assemblies (excuse my bad
> terminology)
> of the source code, but that it is quiet easy to disassemble the
> assemblies,
> so that does not seem to afford read protection.
> or am I just all over nothing!
> thanks
>

newbie: I dont want my .aspx and .cs files to have the source viewable by the client

I'm creating a C# .net project, for a client. However they only have the
right to the binaries, not the source code. Is there a way to compile it so
that I just give them dll's? or do they need the .aspx pages. I read
somewhere that I could probably make assemblies (excuse my bad terminology)
of the source code, but that it is quiet easy to disassemble the assemblies,
so that does not seem to afford read protection.

or am I just all confused over nothing!

thanksYou need to give them the ASPX pages and the compiled DLLs, but you do not
need to give them the .CS source code files.
If they are unethical they could decombile the DLLs to get a rough
approximation of the source code, but you can thwart them with an
Obfuscator.
Visual Studio 2003 has a basic built in obfuscator, but for 2002 you'll need
a 3rd party solution.

Here's more information on obfuscators:
http://www.abderaware.com/WhitePapers/Obfuscator.htm
http://www.preemptive.com/dotfuscator/index.html
http://www.devx.com/SummitDays/Article/11351
http://www.lesser-software.com/ilobf.htm

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net

"Seth Broomer" <asdf@.asdsd.com> wrote in message
news:eWLgn06jEHA.1656@.TK2MSFTNGP09.phx.gbl...
> I'm creating a C# .net project, for a client. However they only have the
> right to the binaries, not the source code. Is there a way to compile it
> so
> that I just give them dll's? or do they need the .aspx pages. I read
> somewhere that I could probably make assemblies (excuse my bad
> terminology)
> of the source code, but that it is quiet easy to disassemble the
> assemblies,
> so that does not seem to afford read protection.
> or am I just all confused over nothing!
> thanks
FYI - Just remember there are Deobfuscator out there. But at least you are
taking some sort of measure to secure the DLLs.

"Steve C. Orr [MVP, MCSD]" wrote:

> You need to give them the ASPX pages and the compiled DLLs, but you do not
> need to give them the .CS source code files.
> If they are unethical they could decombile the DLLs to get a rough
> approximation of the source code, but you can thwart them with an
> Obfuscator.
> Visual Studio 2003 has a basic built in obfuscator, but for 2002 you'll need
> a 3rd party solution.
> Here's more information on obfuscators:
> http://www.abderaware.com/WhitePapers/Obfuscator.htm
> http://www.preemptive.com/dotfuscator/index.html
> http://www.devx.com/SummitDays/Article/11351
> http://www.lesser-software.com/ilobf.htm
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://Steve.Orr.net
>
> "Seth Broomer" <asdf@.asdsd.com> wrote in message
> news:eWLgn06jEHA.1656@.TK2MSFTNGP09.phx.gbl...
> > I'm creating a C# .net project, for a client. However they only have the
> > right to the binaries, not the source code. Is there a way to compile it
> > so
> > that I just give them dll's? or do they need the .aspx pages. I read
> > somewhere that I could probably make assemblies (excuse my bad
> > terminology)
> > of the source code, but that it is quiet easy to disassemble the
> > assemblies,
> > so that does not seem to afford read protection.
> > or am I just all confused over nothing!
> > thanks
>

Newbie: JavaScript validation on <Asp:CheckBox click

It might be a simple question.
I am very new to ASP.Net 2, and stuck with a problem.
How can I execute a client side JavaScript function on CheckBox click.
I am able to execute function at server, But I don't know how to validate at
client side before going to server.
This code is within a GridView
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server"
Checked='<%# Bind("OpenConnection") %> '
Enabled="True"
OnCheckedChanged="OpenConnection_Clicked" AutoPostBack="True" />
</ItemTemplate>
When I put onClick="Javascript:FunctionName" within the tag, it says:
Validation (ASP.Net): Attribute'onclick' is not a valid attribute for
element 'CheckBox'.
Please help me.
I'll appreciate your help.
Thanks, RobIt looks like button would better suit the purpose - usually when you want t
o
perform an action (as you do with AutoPostBack="true") a button or a link is
the way to go, and you could use OnClientClick property to inject your
javascript
HTH
"Rob" wrote:

> It might be a simple question.
> I am very new to ASP.Net 2, and stuck with a problem.
> How can I execute a client side JavaScript function on CheckBox click.
> I am able to execute function at server, But I don't know how to validate
at
> client side before going to server.
>
> This code is within a GridView
> <ItemTemplate>
> <asp:CheckBox ID="CheckBox1" runat="server"
> Checked='<%# Bind("OpenConnection") %> '
> Enabled="True"
> OnCheckedChanged="OpenConnection_Clicked" AutoPostBack="True" />
> </ItemTemplate>
> When I put onClick="java script:FunctionName" within the tag, it says:
> Validation (ASP.Net): Attribute'onclick' is not a valid attribute for
> element 'CheckBox'.
> Please help me.
> I'll appreciate your help.
> Thanks, Rob
>
>

Newbie: JavaScript validation on <Asp:CheckBox click

It might be a simple question.
I am very new to ASP.Net 2, and stuck with a problem.
How can I execute a client side JavaScript function on CheckBox click.
I am able to execute function at server, But I don't know how to validate at
client side before going to server.

This code is within a GridView
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server"
Checked='<%# Bind("OpenConnection") %'
Enabled="True"
OnCheckedChanged="OpenConnection_Clicked" AutoPostBack="True" />
</ItemTemplate>

When I put onClick="javascript:FunctionName" within the tag, it says:
Validation (ASP.Net): Attribute'onclick' is not a valid attribute for
element 'CheckBox'.

Please help me.
I'll appreciate your help.

Thanks, RobIt looks like button would better suit the purpose - usually when you want to
perform an action (as you do with AutoPostBack="true") a button or a link is
the way to go, and you could use OnClientClick property to inject your
javascript

HTH

"Rob" wrote:

Quote:

Originally Posted by

It might be a simple question.
I am very new to ASP.Net 2, and stuck with a problem.
How can I execute a client side JavaScript function on CheckBox click.
I am able to execute function at server, But I don't know how to validate at
client side before going to server.
>
>
This code is within a GridView
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server"
Checked='<%# Bind("OpenConnection") %'
Enabled="True"
OnCheckedChanged="OpenConnection_Clicked" AutoPostBack="True" />
</ItemTemplate>
>
When I put onClick="javascript:FunctionName" within the tag, it says:
Validation (ASP.Net): Attribute'onclick' is not a valid attribute for
element 'CheckBox'.
>
Please help me.
I'll appreciate your help.
>
Thanks, Rob
>
>
>

Saturday, March 24, 2012

Newbie: Upload large file from client to server in ASP.NET

I have seen many posts for this same subject, but my project has some
odd requirements. I need to develop an ASP app that will upload a
large file (200 MB+) to a server without any user interaction, meaning
I can's simply put a file input box on the page and let the user
choose the file. I basically need them to click a button and have the
file transferred. I know that this would be a dangerous practice if
anyone could do it, but is it possible in a controlled environment?
Because of the size of the file I have been looking at FTPing it, but
can't figure out how to get client script to start the FTP. I have
also found this code (below) that utilizes a web service, but I don't
see how the client-script would get the file from the client since it
appears to be ASP. Any ideas for this situation would be MUCH
appreciated.

<WebMethod()> PublicFunction UploadFile(ByVal fs()AsByte,ByVal
FlNameAsString)AsString
Try
Dim m As New MemoryStream(fs)
Dim f As New FileStream("c:\tempUploaded\" & FlName,
FileMode.Create)
m.WriteTo(f)
m.Close()
f.Close()
f = Nothing
m = Nothing
Return "File Uploaded"

Catch ex As Exception
Return ex.Message
End Try
End Function

The UploadFile Webmethod accepts a byte array and the name of the
file, the byte array is copied to a memory stream which is written to
a FileStream.

The client code to upload a file,

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Try
Dim f As System.IO.File
Dim fs As System.IO.FileStream
Dim o As New localhost.Service1()
'file to upload
fs = f.Open("c:\upload.pdf", IO.FileMode.Open, IO.FileAccess.Read)
Dim b(fs.Length - 1) As Byte
fs.Read(b, 0, fs.Length)
MsgBox(o.UploadFile(b, "upload.pdf"))
f = Nothing
fs.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End SubYou can use the HTTP classes to write an upload client as a Winexe, there
are examples in the SDK of how to do this using the webclient uploadfile
method, as shown here.

Console.Write("\nPlease enter the URL to post data to : ");
String uriString = Console.ReadLine();

// Create a new WebClient instance.
WebClient myWebClient = new WebClient();

Console.WriteLine("\nPlease enter the fully qualified path of the
file to be uploaded to the URL");
string fileName = Console.ReadLine();

Console.WriteLine("Uploading {0} to {1} ...",fileName,uriString);
// Upload the file to the URL using the HTTP 1.0 POST.
byte[] responseArray =
myWebClient.UploadFile(uriString,"POST",fileName);

// Decode and display the response.
Console.WriteLine("\nResponse Received.The contents of the file
uploaded are: \n{0}",Encoding.ASCII.GetString(responseArray));

You then need to control your server side timouts, and set your
machine.config settings to control the ma file size permitted for uplaods
(look it up - cant recall all the settings)

If you want to resort to FTP, then you can easily script the FTP.EXE that
comes with windows with the /s flag.

--
Regards

John Timney (Microsoft ASP.NET MVP)
--------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
--------------

"Greg" <greg_leflar@.hotmail.com> wrote in message
news:1651b2f9.0308171354.6c1ee8ae@.posting.google.c om...
> I have seen many posts for this same subject, but my project has some
> odd requirements. I need to develop an ASP app that will upload a
> large file (200 MB+) to a server without any user interaction, meaning
> I can's simply put a file input box on the page and let the user
> choose the file. I basically need them to click a button and have the
> file transferred. I know that this would be a dangerous practice if
> anyone could do it, but is it possible in a controlled environment?
> Because of the size of the file I have been looking at FTPing it, but
> can't figure out how to get client script to start the FTP. I have
> also found this code (below) that utilizes a web service, but I don't
> see how the client-script would get the file from the client since it
> appears to be ASP. Any ideas for this situation would be MUCH
> appreciated.
> <WebMethod()> PublicFunction UploadFile(ByVal fs()AsByte,ByVal
> FlNameAsString)AsString
> Try
> Dim m As New MemoryStream(fs)
> Dim f As New FileStream("c:\tempUploaded\" & FlName,
> FileMode.Create)
> m.WriteTo(f)
> m.Close()
> f.Close()
> f = Nothing
> m = Nothing
> Return "File Uploaded"
> Catch ex As Exception
> Return ex.Message
> End Try
> End Function
> The UploadFile Webmethod accepts a byte array and the name of the
> file, the byte array is copied to a memory stream which is written to
> a FileStream.
> The client code to upload a file,
> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button1.Click
> Try
> Dim f As System.IO.File
> Dim fs As System.IO.FileStream
> Dim o As New localhost.Service1()
> 'file to upload
> fs = f.Open("c:\upload.pdf", IO.FileMode.Open, IO.FileAccess.Read)
> Dim b(fs.Length - 1) As Byte
> fs.Read(b, 0, fs.Length)
> MsgBox(o.UploadFile(b, "upload.pdf"))
> f = Nothing
> fs.Close()
> Catch ex As Exception
> MsgBox(ex.Message)
> End Try
> End Sub
Thank you for your reply. Your code sample makes sense. How would I
then execute that script on the client from an aspx? Again, I don't
know if this is even possible because of the devious implications, but
the client is on our LAN so I have complete control.

"John Timney \(Microsoft MVP\)" <timneyj@.despammed.com> wrote in message news:<OT1XywQZDHA.2668@.TK2MSFTNGP09.phx.gbl>...
> You can use the HTTP classes to write an upload client as a Winexe, there
> are examples in the SDK of how to do this using the webclient uploadfile
> method, as shown here.
> Console.Write("\nPlease enter the URL to post data to : ");
> String uriString = Console.ReadLine();
> // Create a new WebClient instance.
> WebClient myWebClient = new WebClient();
> Console.WriteLine("\nPlease enter the fully qualified path of the
> file to be uploaded to the URL");
> string fileName = Console.ReadLine();
> Console.WriteLine("Uploading {0} to {1} ...",fileName,uriString);
> // Upload the file to the URL using the HTTP 1.0 POST.
> byte[] responseArray =
> myWebClient.UploadFile(uriString,"POST",fileName);
> // Decode and display the response.
> Console.WriteLine("\nResponse Received.The contents of the file
> uploaded are: \n{0}",Encoding.ASCII.GetString(responseArray));
> You then need to control your server side timouts, and set your
> machine.config settings to control the ma file size permitted for uplaods
> (look it up - cant recall all the settings)
> If you want to resort to FTP, then you can easily script the FTP.EXE that
> comes with windows with the /s flag.
> --
> Regards
> John Timney (Microsoft ASP.NET MVP)
> --------------
> <shameless_author_plug>
> Professional .NET for Java Developers with C#
> ISBN:1-861007-91-4
> Professional Windows Forms
> ISBN: 1861005547
> Professional JSP 2nd Edition
> ISBN: 1861004958
> Professional JSP
> ISBN: 1861003625
> Beginning JSP Web Development
> ISBN: 1861002092
> </shameless_author_plug>
> --------------
> "Greg" <greg_leflar@.hotmail.com> wrote in message
> news:1651b2f9.0308171354.6c1ee8ae@.posting.google.c om...
> > I have seen many posts for this same subject, but my project has some
> > odd requirements. I need to develop an ASP app that will upload a
> > large file (200 MB+) to a server without any user interaction, meaning
> > I can's simply put a file input box on the page and let the user
> > choose the file. I basically need them to click a button and have the
> > file transferred. I know that this would be a dangerous practice if
> > anyone could do it, but is it possible in a controlled environment?
> > Because of the size of the file I have been looking at FTPing it, but
> > can't figure out how to get client script to start the FTP. I have
> > also found this code (below) that utilizes a web service, but I don't
> > see how the client-script would get the file from the client since it
> > appears to be ASP. Any ideas for this situation would be MUCH
> > appreciated.
> > <WebMethod()> PublicFunction UploadFile(ByVal fs()AsByte,ByVal
> > FlNameAsString)AsString
> > Try
> > Dim m As New MemoryStream(fs)
> > Dim f As New FileStream("c:\tempUploaded\" & FlName,
> > FileMode.Create)
> > m.WriteTo(f)
> > m.Close()
> > f.Close()
> > f = Nothing
> > m = Nothing
> > Return "File Uploaded"
> > Catch ex As Exception
> > Return ex.Message
> > End Try
> > End Function
> > The UploadFile Webmethod accepts a byte array and the name of the
> > file, the byte array is copied to a memory stream which is written to
> > a FileStream.
> > The client code to upload a file,
> > Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles Button1.Click
> > Try
> > Dim f As System.IO.File
> > Dim fs As System.IO.FileStream
> > Dim o As New localhost.Service1()
> > 'file to upload
> > fs = f.Open("c:\upload.pdf", IO.FileMode.Open, IO.FileAccess.Read)
> > Dim b(fs.Length - 1) As Byte
> > fs.Read(b, 0, fs.Length)
> > MsgBox(o.UploadFile(b, "upload.pdf"))
> > f = Nothing
> > fs.Close()
> > Catch ex As Exception
> > MsgBox(ex.Message)
> > End Try
> > End Sub

Thursday, March 22, 2012

newby needs no record found help

ok I'm new to ASP but I have everything working great I have a form in which client can look up status i want to be able to redirect to a no record found page when a wrong id number is entered here is website http://www.cargogroupllc.com/cargotracking.asp example of good record enter 12321 example of bad record 33333333 please help this is last thing I need to accomplishShow the code of the page, then I can help you!
Edited by SomeNewKid. Please post code between<code> and</code> tags.



ASP protion of page

<%
strSearch = Request.Form("search")

If strSearch <> "" Then
Dim strConnect, SQL
Dim RS
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("securefiles/ITtracking.mdb") & ";"

SQL = "SELECT * FROM ITTable WHERE INSTR(ITTable.ITNumber,'" & strSearch & "')"

Set RS = Server.CreateObject("Adodb.Recordset") 'Used for pulling main categories from DB
RS.Open SQL,strConnect

'If Len(strSearch) > 1 AND LCase(strSearch) = LCase(RS("Name")) Then
Response.Write RS("ITNumber") & "<BR><BR>"
Response.Write RS("DateArrived") & "<BR><BR>"
Response.Write RS("RefNumber") & "<BR><BR>"
Response.Write RS("Quantity") & "<BR><BR>"
Response.Write RS("PUDate") & "<BR><BR>"
Response.Write RS("PUNumber") & "<BR><BR>"
Response.Write RS("OriginalIT") & "<BR><BR>"
Response.Write RS("ValidatedIT") & "<BR><BR>"
Response.Write RS("CustomsRelease") & "<BR><BR>"
Response.Write RS("ShippingTally") & "<BR><BR>"
Response.Write RS("NVOCCRelease") & "<BR><BR>"
Response.Write RS("PaperlessIT") & "<BR><BR>"
'End If

'If Len(strSearch) <= 0 Then
'Response.Write "Sorry no record & "<BR>"
'Response.Write RS(sorry no record) & "<BR><BR>"

'End If

RS.MoveNext

RS.Close

End If

%>