Click here to Skip to main content
15,889,034 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello

I am looking for a way to host a asp.net web application / site in c#.

What is the way I would go about accomplishing such a task?

[INFO]
I have a c# application.
In the applications files there would be a folder in which the websites files would be stored.
I need this application to serve as a web server.
I have been able to host a web server with custom http commands, eg: http://localhost:8081/DO/ieplore.exe (and the application would open Internet explorer)
I have also been able to server html pages from within a specified folder in my application.

[REASON FOR FOLDER]
Actual page code is hidden from access and tampering.

[NOW]
I need to be able to do this with asp.net pages with active code inside.

How would I go about accomplishing this?

Thanks.
Posted

Hello, Mitchell,

[Not entirely sure what your question exactly, but you can adjust\explain and I will add info to the answer to be more specific]

There is no problem adding code in your web pages.
If you are talking about server-side-code that can be C# as it seems your preferable choice, but if you looking into client-side-code then I'd suggest you use Javascript.

If you want the server side code to be able to perform tasks such as running a specific exe file, as per your example then note that you will need to boost permissions of the website on the local server machine.

If you need an advice on the preferred application that is used to host ASP.NET sites then that is of course IIS.

You can use NTFS permissions to block all access to the folder other than your selected users (locally) or the same idea if you want to use LDAP (e.g. active directory users and permissions)

This way other users that have access to the computer will not be able to access the folder, your web page can access the files either with the IIS default user or you can implement impersonation (let me know if you need links explaining "how to") to access with the folder with the user of your choice.


Cheers,
Edo
 
Share this answer
 
v2
Comments
Mitchell Robert 20-Jan-13 8:30am    
Hello

Thank you for responding.

What I want to do in a nutshell is have a portable webserver that can be deployed on any machine just like a normal c# webserver.
But, with the feature of serving asp.net pages.
But!, I need the pages to be securely stored inside the c# webserver so the clients don't have access to the web files directly.

So, how would I go about serving an asp.net website from within the c# webserver application to any connected client.

The main reason for this is having the websites pages hidden.

Thanks
kanha.460 20-Jan-13 13:13pm    
please send the links for more info.
kanha.460 20-Jan-13 13:15pm    
please send the links



please send the links for more info.
Joezer BH 21-Jan-13 0:42am    
Hi Kanha,

Which part do you need further info about?
What do you mean by "portable web server"?
you plan on developing an exe-like web-server that will be run with no installation (i.e. without IIS or some other solution)?
 
Share this answer
 
Comments
Mitchell Robert 20-Jan-13 8:38am    
Hello

A normal webserver.

The main thing I need is to be able to server asp.net pages without the asp.net pages being available to anyone with access to the computer.

Eg: If I use IIS or WAMP
The files are directly available to anyone with access to the folder.

I need those files hidden in a webserver that the same job as IIS but with hidden files.

Hope this clarifies it.

Thanks
Joezer BH 20-Jan-13 8:44am    
You can use NTFS permissions to block all access to the folder other than your selected users (locally) or the same idea if you want to use LDAP (e.g. active directory users and permissions)

This way other users that have access to the computer will not be able to access the folder, your web page can access the files either with the IIS default user or you can implement impersonation (let me know if you need links explaining "how to") to access with the folder with the user of your choice.
Mitchell Robert 20-Jan-13 8:49am    
Hello

Yes! I didn't think about that!

But what about if someone removes the hard drive?
They will still have access to the files?

Thanks
Joezer BH 20-Jan-13 8:53am    
You do the same thing with Network storage rather than hard drive of course, if you have a that kind of concern.

(Of course if the drive is extracted there will be no access to the folder)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900