By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,462 Members | 799 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,462 IT Pros & Developers. It's quick & easy.

how to embed text file in asp.net application

P: n/a
I have an ASP.NET application, I need to distribute it to clients. I used
some text file to stroed database scripts, .sql files.

Those .sql files are very very important part of the application, I like to
hide them from clients.

Is there a way to embed those .sql text file into the compiled .dll file? so
that client can not read it???
Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hello Guoqi,

This has worked for me on projects where I need to embed something in the
DLL:

In the solution explorer, set your SQL file(s) to be "Embedded Content"

'some vb.net code to access your embedded resource:
Dim executing_assembly As System.Reflection.Assembly = Me.GetType.Assembly.GetEntryAssembly()
Dim my_namespace As String = executing_assembly.GetName().Name.ToString()
Dim text_stream As Stream = executing_assembly.GetManifestResourceStream(my_na mespace
+ "MySqlFile.sql")
If Not (text_stream Is Nothing) Then
'read your data from text_stream here. Supply your own code to to whatever
you need
'if you don't know how to do this, look in the MSDN library for help
on file IO
End If

HTH
Todd A.
I have an ASP.NET application, I need to distribute it to clients. I
used some text file to stroed database scripts, .sql files.

Those .sql files are very very important part of the application, I
like to hide them from clients.

Is there a way to embed those .sql text file into the compiled .dll
file? so that client can not read it???

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.