C# - How To Load A Class Contained In A Website From A DLL Referenced By That Website
Apr 2, 2010
so this is alittle bit obscure and I'm not sure its the best way of doing what I'm trying to do but here goes.
Basically I have a Presentation Layer Dll in my web site which handles the Model View Presenter classes. The presentation layer also handles login for my website and then calls off to a web service. Currently whenever the presentation layer calls to a model it verifies the users details and if they are invalid it calls to a loginHandler which redirects the user to the login page. However I cannot dynamically load a new istance of the Login Page in my website from within my Presentation layer.
I've tried to use reflection to dynamically load the class but Since the method call is in the presentation assembly it is only looking within that assembly while the page I want to load is in the website.
heres the reflection code that loads the View:
public ILoginView LoadView()
{
string viewName = ConfigurationManager.AppSettings["LoginView"].ToString();
Type type = Type.GetType(viewName, true);
object newInstance = Activator.CreateInstance(type);
return newInstance as ILoginView;
}
how to search within the website assembly? Ideal I don't want to tie this implementation into the website specifically as the presentation layer is also used in a WPF application.
How to access proxy class of a web service which has been referenced in the website project of a solution within a class library project in the same solution?
I mean no web-service reference/setting is added to the class library and instead it needs to be picked from the web project.
I've found that some of my ASP.Net web apps prompt the browser to load plugins that I'm not explicitely using and certainly haven't deliberately referenced in the project settings.Two that come to mind are for MS MediaPlayer and the "SVG Viewer for Netscape".The only commonality I've determined so far is that the two sites/apps affected both use Master pages (nested in some cases).We don't use SVG file types (just the normal mix of jpg/gif/png) and no video/audio (not yet anyway).Can anyone provide a hint as to where the references for these might be creeping in? e.g. Is it a server-level include? Or a .Net runtime default when using master pages?Does anyone else even experience this, or is it just me?
I have a solution with a website and a class library. I have renamed the class library project from Insight_WebControls to Insight.WebControls. I have also renamed the assembly it produces in its properties.
I have removed from the website's references the old class library and added the new.
However, when I try to build the website, I get the error 'Could not load file or assembly 'Insight_WebControls' or one of its dependencies. The system cannot find the file specified.' There is a dll called 'Insight.WebControls' in the bin folder. Clearly some part of the website is still looking for the old filename. Can anyone tell me how to point it to Insight.WebControls.dll instead?
I've got an external site that's built in SharePoint 2007. the user of the site need to have an option to view the full site when accessed from a mobile device. I am thinking of just creating a button control to do this. The question is, what would be the best solution to do this?
I have created a simple ASP.NET Website in Visual Studio 2008. I have a static C# class (lets call it someClass) contained in a separate file in the App_Code folder. I call a method from that class in my page's code behind like so:
someVar = someClass.someMethod(someParam);
This compiles correctly in VS 2008 but when I move it over to my IIS server, I get the following error (CS0103): Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS0103: The name 'someClass' does not exist in the current context I have created a virtual directory for this website enabling 'Read', 'Run scripts (such ASP)', and 'Execute (such as ISAPI applications or CGI)'. I am not currently utilizing namespaces (as I thought I would not need to and I'm not sure how to use them properly). What am I doing wrong?
I have a Settings.cs class that exposes some Static properties. Those properties are read-only. This class reside in a seperate DLL than the website.
On the application start, I need to initialize the Settings.cs class and populate the Static properties with values. This shall be done once per Application Start.
I am hooking to the Application_Start event in the Web Application. How can I access those "private" Static properties on the Settings.cs class (residing in a separate DLL)?
I have one option which is let the Settings.cs class populate itself. But again I need to do so once per application start.
I'm trying to write a txt file from a vb class (.vb) and need to know where my app is locates, most users upload my proyect in a virtual directory from iis and I cannot use the Application.Path property because I'm not doing this from a form.
I am working on asp.net (newbie) and I am trying to understand what it means to do "load balancing" for the web site. The website will be used by multiple users and resources (database, web service,..).
I really like coding in VB and i have built a few windows forms and messed around a bit so recently i dove into the web forms and website coding aspect of my VB 2010 studio. i watched a the tutorials and i've been all over this forum but i can't get my webpage to load in my browser. the top line of code, that comes with the default ASP.NET website:
I have a process in which a user uploads a file to a web site where the file is then processed and uploaded into the database. The process of validating the file could take several minutes so as soon as the file is uploaded I create a new thread and I do my processing on this second thread. This works great on my local machine but doesn't work at all on my IIS 7 test server.
After some investigating I found the problem is that the process is trying to load a reference to Castle and it can't find the DLL. I have a copy of Castle DLLs in my bin and it works elsewhere in my app. I ran Fuslog and discovered that it is trying to load castle from the wrong location. It is trying to load from c:/windows/system32/inetsrv/.
It appears that under IIS 7 the second thread is executing in a different context or something.
I am building an ASP.NET 3.5 application in which I have a page which loads another page in a different domain in an iframe. Below is the for Default.aspx page:
I have a requirement, where I will have to write a code to create a shortcut for IE on desktop. When the user clicks on this shortcut, It should open up a specific website.
A friend suggested instead of having a backend class which verifies the user permission in every public function (results are cached and non static) i should have a more 'streamlined' site. When i dropped the backend i also drop the database code and merged them in the appropriate user permission (base user, logged_in_user, moderator).
The site code looks better now that merging them has decreased LOC (tons of LOC in fact) and i write Method() instead of backend.Method() which increases readability. However now that i have no backend how am i suppose to unit test my code? and what about things like user file upload with different extensions? (txt vs jpg vs FLAC)
I have moved to a new computer.. and I forgot how I setup the following within Visual Studio 2008...
on my previous computer:
[1]I have a MY_SITE solution
within that solution I have:
[2]T:MySiteFolder
[3]I have MY_SITEClassLibrary (which actually is just a reference to a folder that contains a lot of .cs files - that is within the T:MySiteFolderTheClassLibrary)
... then... if I have USING MY_SITEClassLibrary in any aspx.cs file, I can reference the various classes..
when I move to a NEW computer and a new visual studio 2008 installation... if I open the T:MySiteFolder website... it just opens as a normal website without the MY_SITEClassLibrary as a primary object......
so, can anyone remind me how to again setup this relationship within my new visual studio installation/computer?
The home page of my website and some other page also are taking some time to load, instead of making them load fast, I want some please wait screen or progress bar and mean while the required page would be loaded behind.
I am developing a C# VS 2008 / SQL Server 2008 website. Although this same code compiles in the Project version, the website version does not compile. Many of their files are the same so I do not understand even where to look. The only compile error I get is:
Could not load type 'DataMatch'
in my DataMatch.aspx file. Is the problem in my web.config file? How do websites differ from projects in VS? All four of these files reside in same directory.
I inherited a .Net website project. Except for just 3 .aspx.cs files, pretty much every other file is a .aspx file.
I don't see any .csproj or any .sln files.
If I want to load up this website on my localhost, how would I go about doing it? Am I supposed to load up Visual Studios and "import" these *.aspx.cs and *.aspx file?
I already successfully set up the SQL Server database and updated the web.config with the appropriate credentials.
I have a website that i converted from asp .net 1.1 to 2.0 and now i have one page that said ambiguous reference because in 1.1.all controls needed to be defined in the class as well. Well after deleting those and leaving only the declares in the Markup,it says that the variables do not exists in current context. Intellisense allows me to use and reference them from the page but when trying to build it leaves me with that error.
My company has several class libraries we use in multiple website projects (not web application projects). Website projects don't have .sln files, but I'm sure I've read in my past research that you can make a blank solution and put your website and class library projects in it. After answers to my previous questions, this is the direction that I'm going (based slightly on [URL]
Then I planed on using svn:externals to copy /library1, /library2, and so on into the working_copy/websites/website1/ folder. I want my team members to be able to checkout the /trunk folder for website1 and get a .sln file, /library1 external, /library2 external, etc. I want that .sln file to contain the website1 website project, and all of the library external projects. Hopefully that would look something like:
/working_copy /websites /website1 /trunk /website1 /library1 (svn:external of libraries/library1/trunk/library1) /library2 (svn:external of libraries/library2/trunk/library2) /etc. website1.sln
So, at the end of all of this, the goal is that my teammates check out the trunk, open the solution, and everyone has the exact same solution. When we commit, everything is committed appropriately to subversion (the website code, and the libraries are committed to their appropriate place on the repo). How have others solved these issues? How can I make a .sln file that my team members and I can share in this manner?
I want to undertand and change an existing website which was written long time back. It cntains a lot of code and I dont know where to start as there is no dicumentation.Is there any way by which i can create a class diagram and sequence diagram of the existing one as I want to incorporate all the existing functionalities in the new one and dont miss out anyone. Only way I know is to debug the current application and go through whole of the code individually. Is there any way out by which I can undertand the current application quickly?
I am trying to send data to DotNetOpenAuth website as described here [URL] Sender receive (500) Internal Server Error. The same code for blank website without DotNetOpenAuth works fine. Should I tweak something?