|
Thanks for reply. But now i am confused to go for a reliable solution regarding file security.
Its right that asp.net location tag didnot work for like it did work for common aspx pages.
I read articles which advocates different solutions, like implementing basic authentication with SSL, to secure the files, and use httpwebrequest type classes to get login on the server and give access to the logined user without prompting a login diaglue.
Some advocate NTLM security, which is new even i heard first time.
You told me to write handelers, i read a little about it, to map IIS extensions with asp.net extension to restrict file access in browser.
But my real problem is i will be having thousands of files, and with hunderd of users having different writes on them, I am looking to having a reliable solution which should also be good in performance.
Can you please put little more light regarding my context explained above.
I will be very thankful to you.
Many Thanks & Best Regards,
adnan
Many Thanks,
Adnan Rafiq
muhammadadnanrafiq@gmail.com
|
|
|
|
|
Hi Adnan,
A handler can be made that will serve out many different files. I'm not going to write one for you, but I can give you some code snippets to give you an idea. (I'm also typing straight into the reply window, so they might be a little wrong).
Firstly you would need some way of identifying what file the user wants, and mapping that to a real file. Lets just assume they are all pdf files in one directory, and the user will ask for them by filename in the querystring (http://yoursite/getFile.ashx?SomeFileName).
So in our handler we can get the file the user wants with the Request.QueryString. Then we can check whether the user has permission to access the file (how you do this is up to you). Then we can send the file to the client.
We want to set the context.Response.ContentType = "text/pdf" (or whatever is appropriate).
We need to find the physical filename of the file, say string filename= "c:\\somedirectory\\" + filename + ".pdf". Then we can use context.Response.WriteFile(filename) to send the file to the client.
Note that you probably want to check the user's input more carefully than I have.
|
|
|
|
|
Thanks Mark, handler works greate for me. regards adnan
Many Thanks,
Adnan Rafiq
muhammadadnanrafiq@gmail.com
|
|
|
|
|
can anyone walk me through how to do this or point me to a resource? My friend google couldn't find me anything about how this is done. I don't mean having another application interact with the service by attaching it to the service process. I would like to step through the code within the service itself.
TIA!
I am a SysAdmin, I battle my own daemons.
|
|
|
|
|
Sure, I do that all the time (but not on remote systems, I only know how to do local services).
In Visual Studio, under Debug, there is a menu item to Attach to Process...
use that to attach to the service process while it's running.
As a further help to me, in my OnStart I put
# if DEBUG
System.Threading.Thread.Sleep ( 60000 ) ;
# endif
so the service sleeps for a minute before starting, giving me time to attach the debugger.
|
|
|
|
|
Thanks for the reply.
Just a couple more question...When you say attach to the server process, what do I attach? Do you mean to attach another application that will communicate to the service? Or do you mean the service application itself? The former I can do but when I run in debug the currently opened service solution I get an error saying I can't run the service that way and it has to be installed or run using the server explorer or net start.
It would be really great if I can step through the code of the running service.
I am a SysAdmin, I battle my own daemons.
|
|
|
|
|
Write the service.
Make a debug build.
Install the service.
Start the service.
Attach the debugger -- Visual Studio -- to the process that is the service. That service has to already be installed and running (or at least asleep in its OnStart method).
|
|
|
|
|
Use the diagnostics namespace:
#if DEBUG
System.Diagnostics.Debugger.Launch();
#endif
This will launch and attach a debugger to the process. Theres a bunch of other useful methods on that class as well.
|
|
|
|
|
hi
i have a main form, when i click on button, the datails form show via showdialog() method, in DetailsForm_Load event, i use delegate to loading data from another thread, here is my code :
myDelegate delInctance = new myDelegate(this.gu2.Show_WaitingForm);<br />
delInctance.BeginInvoke("در حال بارگذاري اطلاعات ...", null, null);<br />
if (this.isNewMode)<br />
{<br />
this.LoadLookUp_TypeResource();<br />
this.LoadLookUp_Group(); <br />
<br />
this.bar_btn_edit.Enabled = false;<br />
this.bar_btn_delete.Enabled = false;<br />
<br />
this.barStaticItem1.Caption = "آماده";<br />
}<br />
else if (this.isEditeMode)<br />
{<br />
this.LoadLookUp_TypeResource();<br />
this.LoadLookUp_Group();<br />
this.InitData();<br />
this.dataNavigator1.Position = this.currentRowIndex;<br />
this.barStaticItem1.Caption = "آماده";<br />
}<br />
this.gu2.Hide_WaitingForm();
but when i load event, finish operation, my form and my app get lost focus window, how to solve my problem and keep focus on my DetailsForm ?
thanks
|
|
|
|
|
SELECT COL1,COL2,SUM(COL1,COL2) AS COL3 FROM TEST;
THAT, sounded logical to me but it's not working!
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
sum will add all values for a single column and give a total. Try col1 + col2 as col3, and in future try reading the docs instead of guessing, and try defining 'it's not working' when you ask a question.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Oops, sorry
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Also, the SELECT COL1, COL2 part will return one row for each row in your table. The SUM function will return only one row no matter how many you have. They are not compatible like that, without grouping by something. See GROUP BY docs.
|
|
|
|
|
Dear all,
i made a package using set up and deployment project of visual studio. now every time i made a change in my code i just recompile the package and i get the new package.. it just happened that i got the spelling of product wrong. To make the setup again very is lengthy process. how can i just rename the setup package and recompile the setup..
i.e i have a package name stepup1 i need to rename it as setup1. Is there any way.
|
|
|
|
|
Hello,
my utility works ok on small data samples, but it's throwing an "Out of memory" exception on me whenever I try to apply it on a bigger data sample (a couple of hundred MBs). The exception is thrown during the sort.
Is this a physical limitation of the DataTable or am I missing something?
This is the dump of the exception description:
System.OutOfMemoryException was unhandled
Message="Exception of type 'System.OutOfMemoryException' was thrown."
Source="System.Data"
StackTrace:
at System.Data.RBTree`1.TreePage..ctor(Int32 size)
at System.Data.RBTree`1.AllocPage(Int32 size)
at System.Data.RBTree`1.GetNewNode(K key)
at System.Data.RBTree`1.Insert(K item)
at System.Data.Index.InitRecords(IFilter filter)
at System.Data.Index..ctor(DataTable table, Int32[] ndexDesc, IndexField[] indexFields, DataViewRowState recordStates, IFilter rowFilter)
at System.Data.DataTable.GetIndex(IndexField[] indexDesc, DataViewRowState recordStates, IFilter rowFilter)
at System.Data.DataView.UpdateIndex(Boolean force, Boolean fireEvent)
at System.Data.DataView.UpdateIndex(Boolean force)
at System.Data.DataView.SetIndex2(String newSort, DataViewRowState newRowStates, DataExpression newRowFilter, Boolean fireEvent)
at System.Data.DataTable.get_DefaultView()
at TickConvertor.Program.Main(String[] args)
Thanks much for any input!
Michal
|
|
|
|
|
Seems like using DataTable.Select() instead of the DataTable.DefaultView.Sort might be the solution.
Michal
|
|
|
|
|
DataTable.Select() is throwing the same exception.
Any ideas?
Thanks,
Michal
|
|
|
|
|
Hi, I was wondering if theres a utility that can convert C# projects to vb.net projects (2005). I know there are many free converters online, but I cannot find any that can convert project files. I do have one, but its for the older 2003 files. Any ideas?
|
|
|
|
|
There are numerous commercial products that do this. I've used them in the opposite direction and found that the same one worked great for a winforms app, and terribly for an ASP.NET app. Having said that, VB being weakly typed, I'd expect a conversion from C# -> VB to go smoother.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Try SharpDevelop (free IDE, open-source equivalent for VS), where u can convert the code by one click. When you have *.vb files converted, just create a new VB project (in VS or SharpDev, whatever) and include all of them.
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
How would you go about converting files in SharpDevelop? I have the program, but cant find any option to convert C# > VB.net
|
|
|
|
|
Hi,
I looking some way to find the Regular expression of some string -
What i mean is that i will give some function string and this function will return some Regular expression that match to this string.
Is there is some way to do it in c# ?
Thanks.
|
|
|
|
|
Nothing built in, you could write a parser to work out, for example, how many alphabetical characters occur, etc, and build *something* that will match.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Yeah, what he said. Plus, to get anything useful from such a routine, I think you'd need to provide several sample strings to get something worthwhile.
If you put in "Hello world", would any of the following be satisfactory?
"^Hello world$"
"^..... .....$"
"^\w\w\w\w\w\s\w\w\w\w\w$"
"^.+ .+$"
"^\w+ \w+$"
|
|
|
|
|
Just curious Yanshof, but what do you need this for?
If you are looking to find a string in another (long) string, then theres a fair few functions on the string class for doing this. RegExs might be very powerful and flexible, but don't assume they are *fast* for simple tasks.
|
|
|
|