C# - Creating A Custom Framework Extension?
Feb 21, 2011
What is the best way to go about creating a custom framework for asp.net?
We have several enterprise level asp.net ecommerce websites all running from completely seperate code bases. What I'd like to do is standardise the common components (session management/urlrewriting/surge control etc) and integrate them into the .net framework at the highest level possible and in a way that my developers cannot (easily) make changes.
I've considered creating a common assembly and just referencing that in each of the solutions but this still relies on the developer wiring up the httphandlers/modules and implementing the basepage design pattern for each individual page/masterpage.
View 1 Replies
Similar Messages:
Feb 1, 2010
In this application I'm working on, I have an extension system based on static events. The whole idea is taken mostly from the (very cool) extension system created in BlogEngine.NET.
Essentially, on Application_Start, an extension instance is created which hooks to static events on classes in the application. Take for example an extension that censors blacklisted words from, say, a forum message before displaying it to the page; When a ForumMessage.OnDisplaying event is triggered, the extension would take the ForumMessage sender object and replace blacklisted words with gibberish.
Example:
static class WordBlackListExtension {
private static string[] _blacklist = new string[] { ... };
static WordBlacklistExtension() { ForumMessage.OnDisplaying += DoWork; }
private static void DoWork(object sender, EventArgs e) {
// Do some blacklist filtering...
((ForumMessage)sender).Body = ...;
}
}
However, since there is only one instance of each extension in the App Domain, it occurs to me this only works on a system where there is a single, system-wide configuration for each extension. But what if I wanted per-forum or per-user control over those extensions, like in Google Labs? Per-forum blacklist, or per-user ability to enable/disable the extension? I would have to pass additional information to the extension.
So here's the part I can't wrap my head around - Assuming I have a fairly complex object model (therefore doing something like ForumMessage.Forum.etc.Config is bad practice);
How would you recommend to pass that information to each extension? Should each extension retrieve its own config? Maybe pass some kind of context object through the EventArgs? Where can I determine which forum's config to retrieve?
View 1 Replies
Oct 18, 2010
namespace MvcLogin_Validation.Helpers
{
public static class LabelExtensions
[code]...
View 4 Replies
Mar 7, 2010
I am trying to add page with custom extension, say .asp2 with my set of html tags.Now whenever i try to access the page on browser...it asks me "Save as". This happens because I am using an extn which the server is not able to recognise.What should I do to so that my server, IIS 5.1 recognises this extension??
how to associate custom events on such custom page?
View 2 Replies
Oct 24, 2010
i have mapped *.xyz extension to my own custom handler in asp.net and can run it on Windows asp.net.
How can I do the same thing on mono (Linux/Apache - ubuntu)?
I have this in my web.config:
<httpHandlers><add path="*.xyz" verb="*" type="MyCustomHandler,...">...
I also added similar things to mod_mono.conf and several other files but still I get http 404 The resource cannot be found.
View 1 Replies
Mar 3, 2010
What I would like to have is a mapping between a custom file extension to a class that is not System.Web.UI.Page but a class of mine that inherits from System.Web.UI.Page.
i.e.:
*.aspx -> System.Web.UI.Page
*.my -> My.Package.MyClass (inherits from System.Web.UI.Page)
I know I can map any extension to be treated like .aspx but I can't find the way to do what I have in mind.
View 3 Replies
Apr 16, 2010
I need to set Custom Error Validation for my site.
I have given [URL] .This says 404 Error.
I already set it my web.config file for 404 error redirection.But it is not working.
View 6 Replies
Nov 29, 2010
I am creating a custom control by inheriting a server control, say LinkButton. There are properties like "BorderColor" available in LinkButton. Let's say, I don't want this particular property to be available when I create an instance of the custom control.
I want to completely hide this particular property (I don't want to override it but disable it.)
My code is as follows:
[Code]....
View 3 Replies
Mar 3, 2010
How to create a custom control and REGISTER IT AND WHERE TO INSERT A CODE IN IT FOR AN EXISTING WEB SITE?
View 4 Replies
Sep 22, 2010
beginner programmer - basic C#, first year of university going too slow in terms of actually learning programming. i'm looking at creating framework for a basic browser game, in the vein of urbandead and the now dead nexuswar. because i'm a student i already have visual studio 08 for free - because of this, and my experience with C#, is it worth it to choose ASP.NET/ADO.NET over PHP/mySQL for this kind of project?
View 3 Replies
Apr 13, 2010
I really enjoy the flex states framework. You define a few states for your control, and then can set child controls to only appear in certain states. Check out this code:
<s:states>
<s:State name="signin"/>
<s:State name="register"/>
[code]...
View 1 Replies
Mar 29, 2011
I was trying to send a Batch request with O-data framework given below is the code sequence.
updateService = new Sys.Data.OpenDataServiceProxy("http://localhost/myservice.svc");
actionSequence = updateService.createActionSequence();
actionSequence.addUpdateAction(newWr, workRequest.__metadata.uri);
try {
actionSequence.execute(
function () {
alert("Success");
},
function (error) {
alert(error._message);
}
);
}
catch (e) {
}
but this is failing because on response in the end i am geting some extra sections such as undefined ..given below is the response that i am geting in the end u can find the last 3-4 lines and junk data. which is
undefined undefined HTTP/1.1
Host: localhost
Accept: application/json
Accept-Charset: utf-8
The RESPONSE DATA
**************************
--batch_5d5c-5276-934b
Content-Type: multipart/mixed;boundary=changeset_ef52-ebe1-2137
--changeset_ef52-ebe1-2137
Content-Type: application/http
Content-Transfer-Encoding: binary
MERGE http://localhost/myservice.svc/data('Document_dd879945-cdd8-4336-95d3-365c52c617bd') HTTP/1.1
Host: localhost
Accept: application/json
Accept-Charset: utf-8
Content-Type: application/json;charset=utf-8
{"__metadata":{"uri":"http://localhost/myservice.svc/data('Document_dd879945-cdd8-4336-95d3-365c52c617bd')","type":"Accelrys.Services.DataContracts.WorkRequest"},"VaultId":"Document_dd879945-cdd8-4336-95d3-365c52c617bd","WorkRequestId":"WR.fee0a427-0652-4493-a785-d4b81f26549c","Title":"TEst
WR from Arun PP - Modified By Arun","Project":null,"CreatedBy":"sqalab\vault.admin","VaultPath":"","CreatedOn":"Mar 27,2011","ModifiedOn":"Mar 27,2011","ModifiedBy":"sqalab\vault.admin","Status":"Not Started","NeededBy":"Dec 31,2000"}
--changeset_ef52-ebe1-2137
Content-Type: application/http
Content-Transfer-Encoding: binary
undefined undefined HTTP/1.1
Host: localhost
Accept: application/json
Accept-Charset: utf-8
--changeset_ef52-ebe1-2137--
--batch_5d5c-5276-934b--
View 1 Replies
Jan 23, 2011
used the built-in Membership framework and has implemented his own provider by creating a class that inherits from MembershipProvider (found in System.Web.Security). I actually went ahead and created a custom provider which inherits from MembershipProvider. The problem is that there are several methods I do not really need. Also, the schema is totally different. Plus, most methods return a MembershipUser which means my User class has to inherit from it as well. So really, what benefits does the MembershipProvider and the whole Membership framework add to my system? Do these benefits justify the fact that I won't be using most of the methods on the class?
View 7 Replies
Aug 11, 2012
We have developed a custom framework using ASP.Net, Entity Framework 4 and the likes to enable launching our custom business applications. The framework uses WCF service bindings so the interfaces could be exposed as ordinary services (API) or webservices.
As for the front end we are currently using MVC3, but it really is a problem because the business users want a very configurable/customizable UI so they can change the look and feel of the apps dynamically.
I have been thinking of exploring the option of using a readymade CMS tool such as DNN or Umbraco or something similar. Using these tools with a custom framework? How do I build the CMS so it can use my framework services to pull/push data?
View 1 Replies
Mar 27, 2010
i'm building an application and i need to manage roles, users and more things so i tought to use the membership provider but i have some questions about it: can i full extend it and can i override the functions to use a database table to store infos about config or i need to build my own provider?
View 4 Replies
Oct 19, 2010
I am using the Entity Framework for the first time and want to know if the following is possible - I have generated my classes from the DB, and have one called Category.
Obviously it has all my fields in the table (ID, CategoryName, SortOrder etc..) but I want to know if I can add a custom property which is not in the table, but is actually the result of a custom method.
I want to add a new property called 'CategoryURL' which is basically the 'CategoryName' property run through a custom method and returns a hyphenated string.
My initial thought is inheriting from the generated Category class and creating something like this inside?
public string CategoryURL
{
get{ return MyCustomMethod(this.CategoryName) }
}
Is this the correct approach? And will 'this.CategoryName' work as I think it should? Basically the end result is when I return a list of 'Category' I want this to be part of the class so I can use it in my foreach loop.
View 1 Replies
Jan 15, 2011
I am woking on a MVC project which require me to put all controllers, models and views into a folder called Mvc instead of the project root, I created a custom viewengine, here is the code:
[Code]....
My Application_Start:
[Code]....
It does not work, when I request [URL], I got: The view 'Index' or its master could not be found. The following locations were searched:
~/Mvc/Views/Index.aspx
~/Mvc/Views/Index.ascx
~/Mvc/Views/Shared/Index.aspx
~/Mvc/Views/Shared/Index.ascx
I expect the custom viewengine to find the view at: ~/Mvc/Views/Home/Index.aspx
View 1 Replies
Oct 2, 2010
I have an existing web application that uses EF and POCO objects. I want to improve the client experience by exposing some of my objects through WCF(JSON). I have this working fine but where I am unsure is how to handle derived objects(not sure if that is the correct term) or IEnumerable anonymous objects if you will.
Let's say I have 3 tables structured like so:
Templates
ID
Template
Groups
ID
Group
Instances
ID
TemplateID
GroupID
This is obviously a one-to-many type relationship. I have my navigation properties setup correctly and getting strongly typed object properties works great. However, how do I send serialized anonymous type object(s) over the wire. Like an object that sends all instances that are equal to groupid=1 and include the names of the template and the object.Am I missing something or do I have to create another class object for WCF that would look like this:
WCF Object
InstanceID
TemplateID
TemplateName
GroupID
GroupName
I guess I could alter my tables to account for this but that seems wrong too. I know that IEnumerable objects can't be serialized and I know that throw away objects are probably not the way to go either. I want to do this the right way but I am not sure how to go about it.
View 1 Replies
Jun 3, 2010
I thought about creating a custom AuthorizeAttribute that will prevent logged in users calling a action ( [UnAuthorized] so to speak)
Tried creating a custom AuthorizeAttribute and override the AuthorizeCore method, but not sure this is the right approach.
(does not work anyhow...get an error telling me "no suitable method found to override")
[Code]....
View 7 Replies
Feb 24, 2011
I have a Results.aspx page that displays the resulting records queried using a SqlDataSource object via a ListView. I want to add a "View" button that will appear next to each record, and when clicked will take me to a separate page that will display details about that record. How do I accomplish this?
Edit
I have tried what you said, citronas and here's what I've come up with:
[Code]....
Unfortunately nothing actually happens...am I missing something?
Edit -- Fixed
I was missing something! I had CommandName equal to my method name instead of OnCommand. I took out CommandName, kept the argument bit and replaced CommandName with OnCommand. Everything works now, but what would I ever need CommandName for?
View 1 Replies
Mar 9, 2011
I have created a custom html helper as follow:
[Code]....
In my View, I am using it like this:
[Code]....
However, for some reason nothing gets rendered!
View 4 Replies
Dec 8, 2010
I don't know is this correct forum for asking this question or not, but i need it very urgently ,please help me out.I need to create a website setup with the following actions.1. Primarily it should first check whether IIS is installed in local machine or not, if IIS is not installed then it should give an Error Message.2. If IIS is present it should Start Installing with all the Content Files and Web Files and Class Files.3. After Installing all the files in IIS it should ask for the Connection String i.e. from where and which database should be taken as connection string, and it should set this connection string in web.config.4. After all this process it should ask for default page to be opened i.e. Which page should be started as first page.5. Then it should automatically open that website with default set page in browser , to check whether it is working fine or not.
View 3 Replies
Jul 5, 2010
I am trying to create a custom datatype. The intention being a dropdown list. As of right now, I can access the control I created but no properties or values are showing up within it. Just the blank drop down.
public partial class usercontrols_admin_customDataType_CountryDropDown :
System.Web.UI.UserControl,
umbraco.editorControls.userControlGrapper.IUsercontrolDataEditor
{
public string umbracoValue;
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
DataSet ds = new DataSet();
FormFieldBuilder countries = new FormFieldBuilder();
ds = countries.GetAllCountries();
ddCountries.DataSource = ds;
ddCountries.DataTextField = ds.Tables[0].Columns["DisplayName"].ToString();
ddCountries.DataValueField = ds.Tables[0].Columns["guiCountryID"].ToString();
ddCountries.DataBind();
}
}
#region IUsercontrolDataEditor Members
public object value
{
get
{
return ddCountries.SelectedValue;
}
set
{
if (value != null)
{
ddCountries.SelectedValue = value.ToString();
}
}
}
#endregion
}
View 1 Replies
Aug 23, 2010
I created user control and want to add it to page. I use next code:
Controls_MultiTextInput cc = new Controls_MultiTextInput();
Controls.Add(cc);
But control doesn't appear on page. What is wrong?
View 2 Replies
Sep 7, 2010
First and foremost ... I already made a few changes in the template, the most important one changing the methods generated for stored procedures with OUTPUT parameters and no resultset so that instead of instantiating a few OutputParameter objects, passing them to the method and extracting the values (all without any type checking) you just call the method with a few "out someType?" parameters so I do not need the very basics. I am totally confused by all those GlobalItem, EdmProperty,BuiltInTypeKind, TypeUsage and all this made of objects, all alike and all different though so as soon as I need more data than what's already used by the template I run into problems :-(What I would like is to change the WritePrimitiveTypeProperty() so that it outputs [StringLength(xxx)] for all char, varchar, nchar and nvarchar properties. But I can't find a way to get from an EdmProperty in the model to the database type in the store.anyone is interested here's the modified stored procedure mapping code for the template. The first code replaces the original in the .tt:
[Code]....
the second needs to be added into a copy of EF.Utility.CS.ttinclude that you add to your project and reference from the .tt
[Code]....
View 4 Replies