Assemblies - Embed Js / Css Images Into Separate Assembly To Read From Website
Sep 3, 2010
I'd like to create a class library project where embed resources like js, css and maybe image files. I would compile it and copy the dll into the bin folder of my web site to include the resources into my pages with GetWebResourceUrl.
I tried with an assembly that have no .cs files, but it doesn't seem to work, I can't see the namespace of the assembly in the web project.
View 1 Replies
Similar Messages:
Apr 14, 2010
I'm building a CMS type of application in MVC. I want to reuse my views and controllers for adding/managing content in at least two other MVC sites. Obviously I dont want more than one code base for the CMS stuff. I figured out a way to do so:
Controllers:
Controllers are easy. Nothing more than creating a new Class Library Project and adding your controllers. Be sure to reference System.Web.MVC. In your MVC project just reference your controller assembly.
Views:
Views are a bit trickier. My solution was to add the folder structure to my assembly
CMSViews
CMSViewsWhatever
Then start adding my view pages. For each page, you have to set the 'Copy to Output Directory' to 'Copy Always' (right click -> properties)
Then I created a new class which inherits from 'WebFormViewEngine'. In the constructor I call the base() and then I add paths to the base.MasterLocationFormats and base.ViewLocationFormats to specify the new locations to look for views.
[Code]....
Setup in MVC project:
To get the controllers and views to work from the assemblies, you have to add two lines of code in the global.asax. Under the RegisterRoutes() method, add
ControllerBuilder.Current.DefaultNamespaces.Add("YourAssemblyNamespace.Controllers");
then under the Application_Start() method add:
ViewEngines.Engines.Add(new YourAssemblyNamespace.MyViewEngine());
What I dont like is that the Views get put into the Bin directory when published and you have to make sure to set the Ouput to Copy Always which is going to be a PITA for larger projects with lots of views.
View 1 Replies
Jan 13, 2010
I am relatively new to ASP.NET programming (but not programming in general), and I have been looking through a project that has been handed off to me. Within this project, there is a bin directory which contains a slew of various DLL files. Then, in the web.conf file, inside the assemblies structure (within the XML), there is a slew of other assemblies being added. I've done a search on both SO and through Google in general, and I am still struggling over what the difference is between the two. Is one way "better" than the other?
View 2 Replies
Jun 1, 2010
I have a web application which uses membership and profiles. I successfully used the WebProfileBuilder extension, so my profile class is correctly generated, and is working nicely. However, after a new request of my client, I need now to move that profile management part into another assembly (so I'd be able to get profile information in a windows service running on the same machine).
What I made is created the new assembly, moved my generated profile file, and tried to use it from the other assembly, but without any success. I always get a SettingsPropertyNotFoundException. My thought is that the profile system doesn't know where to find its connection information, so I tried to add the connectionstring and provider in the app.config of this assembly, but this doesn't seem to work.
View 2 Replies
Feb 17, 2010
I have two projects in my solution: a) MVC Application b) Class Library. The class library acts as a plugin, so it contains views. The main problem is that I have no intellisense in the view's markup for my classes contained within the class library (the same assembly as the views). In the beginning I couldn't even write <%= Html.RenderAction... %>. I've solved that by adding a Web.config file to the class library with the following section:
<configuration>
<system.web>
<compilation debug="true">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
</system.web>
Now it recognizes Html.RenderAction, etc in the view's markup. However I've no idea how to get access (with intellisense) to my classes contained within the same assembly as the views
View 3 Replies
Feb 21, 2010
I just want to know if anyone stores their helper classes or methods in a separate assembly and why...just for clean management of them? I've seen so many posts about using a helper folder inside your MVC project and that brings me back to the messy old days in ASP.NET where people were using an App_code folder instead of cleanly separating things out physically like this into its own project. And likewise nobody doing real architecture is going to put models in some folder in your MVC web assembly. They would go in MyApp.DataLayer assembly or MyApp.Models or something like this.
View 5 Replies
Jul 8, 2010
I have an application in that i m placed one drop down box.Now i want to show some image and other details according to that drop down item in asp page ..I am assigning drop down items in C # .Now the requirment is like on that time click need to show corresponding image on asp page. how to retreive images according to the drop down item value.
View 9 Replies
Mar 31, 2010
In one of my ASP.NET page I have to send email to the users. I did this using System.Net.Mail namespace. The problem is if I want to send images I used the <img src=""/> to display them in my email. But now some of images are not hosted anywhere and I still want ti send the email with images. I want to embed them in my mail. Is there any way to do this in c#.
View 6 Replies
Apr 6, 2010
Here is my code. What do I need to change to get the images referenced in the HTML to embed?
using
System;
using
System.Data;
using
System.Configuration;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Web.UI.HtmlControls;
using
System.IO;
using
System.Net.Mail;
public
partial
class
SendEmail1 : System.Web.UI.Page
{
{
}
{
string FileNameToAttache;protected
void Page_Load(object sender,
EventArgs e)protected
void sendButton_Click(object sender,
EventArgs e)SmtpClient smtpClient =
new
SmtpClient();MailMessage message =
new
MailMessage();try
{
message.To.Add(toEmail);
}
MailAddress fromAddress =
new
MailAddress(fromTextBox.Text);string[] toEmails = toTextBox.Text.ToString().Split(';');foreach
(string toEmail
in toEmails) {//MailAddress toAddress = new MailAddress(toTextBox.Text);
message.From = fromAddress;
//message.To.Add(toAddress);
message.Subject = subjectTextBox.Text;
message.IsBodyHtml =
true;
/* Attaching Files Begin */
{
{
FileNameToAttache =
AttachFile1.PostedFile.SaveAs(Server.MapPath(FileNameToAttache));
message.Attachments.Add(
}
}
emailWithAttach.Host =
emailWithAttach.DeliveryMethod =
emailWithAttach.UseDefaultCredentials =
{
{
FileNameToAttache =
AttachFile1.PostedFile.SaveAs(Server.MapPath(FileNameToAttache));
message.Attachments.Add(
}
}
{
{
FileNameToAttache =
AttachFile1.PostedFile.SaveAs(Server.MapPath(FileNameToAttache));
message.Attachments.Add(
}
}
{
{
FileNameToAttache =
AttachFile1.PostedFile.SaveAs(Server.MapPath(FileNameToAttache));
message.Attachments.Add(
}
}
if (AttachFile1.PostedFile !=
null)HttpPostedFile attFile = AttachFile1.PostedFile;int
attachFileLength = attFile.ContentLength;if (attachFileLength > 0)Path.GetFileName(AttachFile1.PostedFile.FileName);new
Attachment(Server.MapPath(FileNameToAttache)));SmtpClient emailWithAttach
= new
SmtpClient();"Localhost";SmtpDeliveryMethod.Network;true;if
(AttachFile2.PostedFile != null)HttpPostedFile attFile = AttachFile2.PostedFile;int
attachFileLength = attFile.ContentLength;if (attachFileLength > 0)Path.GetFileName(AttachFile2.PostedFile.FileName);new
Attachment(Server.MapPath(FileNameToAttache)));if (AttachFile3.PostedFile
!= null)HttpPostedFile attFile = AttachFile3.PostedFile;int
attachFileLength = attFile.ContentLength;if (attachFileLength > 0)Path.GetFileName(AttachFile3.PostedFile.FileName);new
Attachment(Server.MapPath(FileNameToAttache)));if (AttachFile4.PostedFile
!= null)HttpPostedFile attFile = AttachFile4.PostedFile;int
attachFileLength = attFile.ContentLength;if (attachFileLength > 0)Path.GetFileName(AttachFile4.PostedFile.FileName);new
Attachment(Server.MapPath(FileNameToAttache)));
/* Attaching Files END */
message.Body =
smtpClient.Host =
smtpClient.Send(message);
resultLabel.Text =
}
{
resultLabel.Text =
}
}
{
}
}
"<html><head><title>" +
HttpUtility.HtmlEncode(subjectTextBox.Text) +"</title></head><body style='background-color:#edf8ff;'><div
style='width:600px;'><table width='600' align='center' style='background-color:#ffffff;'>" +
"<img src="[URL]/>" +"<tr><td colspan='2'style='width:500px;'><p>"
+ HttpUtility.HtmlEncode(greetingTextBox.Text) +
"</p></td></tr><br />" +"<tr><td colspan='2'style='width:500px;'><p>"
+ HttpUtility.HtmlEncode(createTextBox.Text) +
"</p></td><img src="[URL]" /></tr><br />" +"<tr><td
colspan='2'style='width:500px;'><p>" + HttpUtility.HtmlEncode(closingTextBox.Text) +
"</p></td></tr>" +"<tr><td><img src="[URL]"
/></td></tr>" +"</table></div></body><html>";"Localhost";"Email
sent! <br />";catch (Exception
ex)"Couldn't Send the Message!";protected
void clearButton_Click(object sender,
EventArgs e)
View 6 Replies
Mar 22, 2011
In context of an ASP.NET Website project, is it possible to create a second location where DLLs will be picked up from, in addition to the regular bin/ location and apart from the GAC? I expect such a feature would be made possible by the configuration.
View 1 Replies
Jul 13, 2011
Is it possible to embed just the body of a different website into my website. I don't want to just add a link because I want my side menu to still be visible when the user is looking through the other websites content.
View 5 Replies
Jan 26, 2010
is it possible to make a single assembly for whole WebSite in Visual Studio 2010?
With Web Deployment Project i can do this in VS2008, but it is not compatible with new version.
View 1 Replies
Feb 25, 2011
I want to read a text file and separate the data and write it back to another text file. So the input file content is like 07090000079011110225000 00001000100010118832 032111050111205011110501111022500000FL .... I know that first 3 characters are for CompanyID, next 2 are for Symbol etc. How Can I put it together? I used to write in VB code like this below using a Type and define the width there.(easy to maintain) How can I do that in VB.Net or c#?
[Code]....
So the output will be like CompanyID : 070 Symbol :90 .
View 8 Replies
May 18, 2010
I am using asp.net with C#. I have a application deployed on the server [published], now I want to see the code for that website, As far as I know I can read assembly to see the code.
View 2 Replies
Jan 31, 2010
read the connection string in a web application from a T4 template residing in ANOTHER assembly referenced by the web application. I am generating some code from the database that it references and how to get the connection string for this use. ive read George Js example here however it only works when the template resides in the web app.
View 2 Replies
May 5, 2010
I have a website and i have a Google Blog . i want my website to display the activities of my google blog in my website. What i want exactly is to embed my Blog into my ASP.NET website. This Should include the Comments and their Updates.
View 3 Replies
Mar 30, 2010
tell me the any player for mp3 audio files. I want to use it in ASP.NET
View 4 Replies
Apr 30, 2010
when I reference a assembly. It's reference gets added to the project file in my case ( ABC.csproj)
Also when I take a look at the web.config file there is a section called <assemblies>. And lot of assemblies are added there.
What is the difference between link to the assemblies in the Project file and the assemblies in the web.config file?
View 1 Replies
Feb 3, 2012
I'm trying to embed pictures, videos etc on my website. I've seen jquery oembed but it seems i need a key to get it to work. How I can implement it.
View 4 Replies
Jun 16, 2015
I'm trying to display a specific location using google maps on my aspx page.
Is there an easy way to do it?
View 1 Replies
May 27, 2010
Is it possible to read the GUID from the Assembly without actually loading it in the current App Domain. Normally Assembly.Load loads the DLL into the app domain. I just want to read the value. The description of the GUID is
'The following GUID is for the ID of the typelib
' if this project is exposed to COM
<Assembly: Guid("DEDDE61CD-928E-4ACD-8C25-3B8577284819")>
The main thing is I don't want to lock the file so that there are no errors 'Another process is accessing the file' error.
View 6 Replies
Feb 18, 2010
I have recently discovered that I am affected by this bug http://www.mail-archive.com/mono-bugs@lists.ximian.com/msg71515.html
Well,at http://www.mail-archive.com/mono-bugs@lists.ximian.com/msg71529.html they say the work around is to create a global policy assembly and redirect the assemblies that way since it is not read from the web.config.
How do you actually do what they describe there? There is a huge documentation gap in that area with Mono.Also,I can't just recompile the assembly to use the new Mono assembly versions because the assembly is closed source.(but it does work with Mono.)
View 1 Replies
Sep 8, 2010
I am trying to figure out what are the basic assemblies required to run a basic ASP.NET 4.0 website. Say.. a website with just a label in it. I looked online and didn't find a list there. I know installing the framework 4.0 will give me all the dlls but I just need the basic ones that will make a basic site work on ASP.NET 4.0.
View 1 Replies
Jul 8, 2010
I have a web application that requires two separate authentication and authorization.
In the root webconfig i configure the security for authenticating and authorizing public users
I also need authentication and authorization for the back end. That is the administrator who will manage the web application.
For this i have a subdirectory "admin" that will contain all the functionality for the back end. In the "admin" subdirectory i have a second web.config and i tried to add all the security for the administrator but it does not let me
Is it possible to have to separate authorization and authentication for a single web application. All the details will be save in microsoft's sql tables generate (for example aspnet... tables)
View 3 Replies
Apr 20, 2010
I created this website and it work fine on local machine but when i upload it to remote server then it throws error that it cant find assembly....
The assembly is not in my Bin folder and i can not find it in my machine or at least don't know where to look.
Parser Error Message: Could not load file or assembly 'MySql.Data, Version=6.2.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The system cannot find the file specified.
View 3 Replies