Showing posts with label files. Show all posts
Showing posts with label files. 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
>

Monday, March 26, 2012

Newbie: Multiple codebehind files

Hi All,

I'm not certain this can be done but it sure seems like it. I'd like to use
multiple C# codebehind files in an aspx page. The idea is that a number of
common functions, like wiring data sources, could be done in a similar
fashion for various controls across multiple pages. What makes sense to me
then would be to have an aspx page that uses a codebehind file. That file
would reference classes in a second file that did the common work.

Assuming I'm on the right track, how would you do this? Is it enough to
simply have both .cs files in the same folder or should each be referenced
in the @dotnet.itags.org.Page's Inherits and Src attributes? Basically, I think the idea
should work, but I'm missing the details on referencing and location.

For example, a control:

<asp:DropDownList id="ddlWidgets" runat="server" /
would be referenced in the codebehind's Page_Load method:

protected void Page_Load( Object Source, EventArgs Args )
{
if (!IsPostBack)
{
WireUpControl( ddlWidgets, "Widgets" );
}
}

where WireUpControl is a method in a class located in a different file that
takes a reference to the control and a table name and binds that table's
data to the control.

TIA,

JohnYou don't need multiple code behinds, just multiple class files if you
will... In which case you can add event handlers etc...

you could have nothing but your event handlers in your code behind that make
reference to other classes.. or, if you have a page that your going to use a
lot of functions a lot... inherit it from system.web.ui.page, creating
your own class with those functions you want.

Then inherit that page into all your otherpages... boom...

This is really effective if you have say a search bar on every page... Just
for example.

-CJ
"John Spiegel" <jspiegel@.c-comld.com> wrote in message
news:unKWETKbDHA.384@.TK2MSFTNGP12.phx.gbl...
> Hi All,
> I'm not certain this can be done but it sure seems like it. I'd like to
use
> multiple C# codebehind files in an aspx page. The idea is that a number
of
> common functions, like wiring data sources, could be done in a similar
> fashion for various controls across multiple pages. What makes sense to
me
> then would be to have an aspx page that uses a codebehind file. That file
> would reference classes in a second file that did the common work.
> Assuming I'm on the right track, how would you do this? Is it enough to
> simply have both .cs files in the same folder or should each be referenced
> in the @.Page's Inherits and Src attributes? Basically, I think the idea
> should work, but I'm missing the details on referencing and location.
> For example, a control:
> <asp:DropDownList id="ddlWidgets" runat="server" />
> would be referenced in the codebehind's Page_Load method:
> protected void Page_Load( Object Source, EventArgs Args )
> {
> if (!IsPostBack)
> {
> WireUpControl( ddlWidgets, "Widgets" );
> }
> }
> where WireUpControl is a method in a class located in a different file
that
> takes a reference to the control and a table name and binds that table's
> data to the control.
> TIA,
> John
Hi John,

Speaking from a C# background, and in an OO sense certainly, you should not
be able to inherit from more than one superclass (unless you are using C or
something). So it makes sense to assume you cannot inherit from more than
one 'codebehind'.

The usual practice is to place commonly used functions in a different
abstract superclass, further up the heirarchy. However, don't lean too
heavily on heirarchies, as they can become difficult to maintain in an
extensibility sense. Consider instead using the strategy pattern as an
alternative?

hth,
Ben

"John Spiegel" <jspiegel@.c-comld.com> wrote in message
news:unKWETKbDHA.384@.TK2MSFTNGP12.phx.gbl...
> Hi All,
> I'm not certain this can be done but it sure seems like it. I'd like to
use
> multiple C# codebehind files in an aspx page. The idea is that a number
of
> common functions, like wiring data sources, could be done in a similar
> fashion for various controls across multiple pages. What makes sense to
me
> then would be to have an aspx page that uses a codebehind file. That file
> would reference classes in a second file that did the common work.
> Assuming I'm on the right track, how would you do this? Is it enough to
> simply have both .cs files in the same folder or should each be referenced
> in the @.Page's Inherits and Src attributes? Basically, I think the idea
> should work, but I'm missing the details on referencing and location.
> For example, a control:
> <asp:DropDownList id="ddlWidgets" runat="server" />
> would be referenced in the codebehind's Page_Load method:
> protected void Page_Load( Object Source, EventArgs Args )
> {
> if (!IsPostBack)
> {
> WireUpControl( ddlWidgets, "Widgets" );
> }
> }
> where WireUpControl is a method in a class located in a different file
that
> takes a reference to the control and a table name and binds that table's
> data to the control.
> TIA,
> John
"John Spiegel" <jspiegel@.c-comld.com> wrote in message
news:unKWETKbDHA.384@.TK2MSFTNGP12.phx.gbl...
> Hi All,
> I'm not certain this can be done but it sure seems like it. I'd like to
use
> multiple C# codebehind files in an aspx page. The idea is that a number
of
> common functions, like wiring data sources, could be done in a similar
> fashion for various controls across multiple pages. What makes sense to
me
> then would be to have an aspx page that uses a codebehind file. That file
> would reference classes in a second file that did the common work.

John,

There are "CodeBehind" files, which are the .aspx.cs files. These are the
"other side" of the .aspx files.

Your web project can contain classes which are not related to a single page.
You can always add these separate classes in .cs files and then reference
them from your codebehind (.aspx.cs) files.
--
John Saunders
Internet Engineer
john.saunders@.surfcontrol.com
Thanks guys. Just the kind of stuff I'm needing.

Desperately looking forward to the day when I can honestly drop the
"Newbie:" tag on my subjects... <g
- John

"John Spiegel" <jspiegel@.c-comld.com> wrote in message
news:unKWETKbDHA.384@.TK2MSFTNGP12.phx.gbl...
> Hi All,
> I'm not certain this can be done but it sure seems like it. I'd like to
use
> multiple C# codebehind files in an aspx page. The idea is that a number
of
> common functions, like wiring data sources, could be done in a similar
> fashion for various controls across multiple pages. What makes sense to
me
> then would be to have an aspx page that uses a codebehind file. That file
> would reference classes in a second file that did the common work.
> Assuming I'm on the right track, how would you do this? Is it enough to
> simply have both .cs files in the same folder or should each be referenced
> in the @.Page's Inherits and Src attributes? Basically, I think the idea
> should work, but I'm missing the details on referencing and location.
> For example, a control:
> <asp:DropDownList id="ddlWidgets" runat="server" />
> would be referenced in the codebehind's Page_Load method:
> protected void Page_Load( Object Source, EventArgs Args )
> {
> if (!IsPostBack)
> {
> WireUpControl( ddlWidgets, "Widgets" );
> }
> }
> where WireUpControl is a method in a class located in a different file
that
> takes a reference to the control and a table name and binds that table's
> data to the control.
> TIA,
> John

Saturday, March 24, 2012

newbie: running asp.bnet application

Hi,

I am trying to run an ASP.net application. What files do I need to keep in inteup and what files can I put anywhere else on my HDisk.??

Thanks,

Hello Bilalso,

I am not really sure what you mean but maybe this will help you out.

The files needed to run an ASP.NET application are all.aspx pages and the completebin folder. The codebehind files (.aspx.cs) are not necessary to run the application when it is compiled all codebehind code is stored in a.dll file which is stored in thebin folder. When you are using usercontrols you should also store the.ascx files and of course any third parties components should be included (usually in thebin folder).

You can store you're website anywhere on your hardrive as long as you configure IIS correctly. To do this create a virtual website under the Default website using the following steps:

- Open IIS
- Select the Default website and press the right mouse button
- Goto New -> Virtual website
- Submit an Alias for the Virual directory (can be anything you want)
- Now select the directory where your website is located on your harddrive
- Leave the access permissions as they are (unless you have special wishes)
- Hit the Finish button and you are ready

A hope this answers your question.

Cheers, Maurits


Hello:

You need to create a new website with either Visual Studio.NET, WebMatrix, Visual Web Express. They will create the website for you, in the wwwroot folder of the inetpub.

Have you installed .NET om your machine?

Regards

Newbie: text files

Sorry if this is a simple question. I have a bunch of text files that I am
allowing I want to display on my web page. When I do a response.writefile
to load the file the CRLFs don't work. How can show the contents of the
text file to the user easily?

Thanks
ChrisA CRLF does not render in the broswer as a break/line feed, you'll have to
read the file into a string var and replace crlf with "<BR>"... HTH

"Chris" wrote:

> Sorry if this is a simple question. I have a bunch of text files that I am
> allowing I want to display on my web page. When I do a response.writefile
> to load the file the CRLFs don't work. How can show the contents of the
> text file to the user easily?
> Thanks
> Chris
>
Dim sr As New System.IO.StreamReader("pathToFile")
response.write(sr.ReadToEnd)

"Chris" <NoSpam@.NoSpam.com> wrote in message
news:%23jD9X6bKFHA.132@.TK2MSFTNGP10.phx.gbl...
> Sorry if this is a simple question. I have a bunch of text files that I
> am allowing I want to display on my web page. When I do a
> response.writefile to load the file the CRLFs don't work. How can show
> the contents of the text file to the user easily?
> Thanks
> Chris
This solution has the same problem as using response.writefile. The CRLF
fields don't display.

Chris

"Scott M." <NoSpam@.NoSpam.com> wrote in message
news:uDBJJBcKFHA.3484@.TK2MSFTNGP12.phx.gbl...
> Dim sr As New System.IO.StreamReader("pathToFile")
> response.write(sr.ReadToEnd)
>
> "Chris" <NoSpam@.NoSpam.com> wrote in message
> news:%23jD9X6bKFHA.132@.TK2MSFTNGP10.phx.gbl...
>> Sorry if this is a simple question. I have a bunch of text files that I
>> am allowing I want to display on my web page. When I do a
>> response.writefile to load the file the CRLFs don't work. How can show
>> the contents of the text file to the user easily?
>>
>> Thanks
>> Chris
>>
"Chris" <NoSpam@.NoSpam.com> wrote in message
news:eLb9fIcKFHA.3916@.TK2MSFTNGP14.phx.gbl...
> This solution has the same problem as using response.writefile. The CRLF
> fields don't display.
> Chris
> "Scott M." <NoSpam@.NoSpam.com> wrote in message
> news:uDBJJBcKFHA.3484@.TK2MSFTNGP12.phx.gbl...
>> Dim sr As New System.IO.StreamReader("pathToFile")
>> response.write(sr.ReadToEnd)
>>
>>
>> "Chris" <NoSpam@.NoSpam.com> wrote in message
>> news:%23jD9X6bKFHA.132@.TK2MSFTNGP10.phx.gbl...
>>> Sorry if this is a simple question. I have a bunch of text files that I
>>> am allowing I want to display on my web page. When I do a
>>> response.writefile to load the file the CRLFs don't work. How can show
>>> the contents of the text file to the user easily?
>>>
>>> Thanks
>>> Chris
>>>
>>
>>

Dim sr As System.IO.StreamReader = New
System.IO.StreamReader("TextFile.txt")
Response.Write(sr.ReadToEnd().Replace(vbNewLine, "<br>")

Hope this helps :)

Mythran
As well as replacing the line breaks with <br /> tags you will want to
Server.HtmlEncode all of your text. Not doing so can cause security problems
if you allow people to upload files. Even if you don't allow people to
upload files, Html encoding the text is a good idea so that everything
displays correctly.

Newbie: text files

Sorry if this is a simple question. I have a bunch of text files that I am
allowing I want to display on my web page. When I do a response.writefile
to load the file the CRLFs don't work. How can show the contents of the
text file to the user easily?
Thanks
ChrisA CRLF does not render in the broswer as a break/line feed, you'll have to
read the file into a string var and replace crlf with "<BR>"... HTH
"Chris" wrote:

> Sorry if this is a simple question. I have a bunch of text files that I a
m
> allowing I want to display on my web page. When I do a response.writefile
> to load the file the CRLFs don't work. How can show the contents of the
> text file to the user easily?
> Thanks
> Chris
>
>
Dim sr As New System.IO.StreamReader("pathToFile")
response.write(sr.ReadToEnd)
"Chris" <NoSpam@.NoSpam.com> wrote in message
news:%23jD9X6bKFHA.132@.TK2MSFTNGP10.phx.gbl...
> Sorry if this is a simple question. I have a bunch of text files that I
> am allowing I want to display on my web page. When I do a
> response.writefile to load the file the CRLFs don't work. How can show
> the contents of the text file to the user easily?
> Thanks
> Chris
>
This solution has the same problem as using response.writefile. The CRLF
fields don't display.
Chris
"Scott M." <NoSpam@.NoSpam.com> wrote in message
news:uDBJJBcKFHA.3484@.TK2MSFTNGP12.phx.gbl...
> Dim sr As New System.IO.StreamReader("pathToFile")
> response.write(sr.ReadToEnd)
>
> "Chris" <NoSpam@.NoSpam.com> wrote in message
> news:%23jD9X6bKFHA.132@.TK2MSFTNGP10.phx.gbl...
>
"Chris" <NoSpam@.NoSpam.com> wrote in message
news:eLb9fIcKFHA.3916@.TK2MSFTNGP14.phx.gbl...
> This solution has the same problem as using response.writefile. The CRLF
> fields don't display.
> Chris
> "Scott M." <NoSpam@.NoSpam.com> wrote in message
> news:uDBJJBcKFHA.3484@.TK2MSFTNGP12.phx.gbl...
>
Dim sr As System.IO.StreamReader = New
System.IO.StreamReader("TextFile.txt")
Response.Write(sr.ReadToEnd().Replace(vbNewLine, "<br>")
Hope this helps :)
Mythran
As well as replacing the line breaks with <br /> tags you will want to
Server.HtmlEncode all of your text. Not doing so can cause security problem
s
if you allow people to upload files. Even if you don't allow people to
upload files, Html encoding the text is a good idea so that everything
displays correctly.