C# - Creating A Google Labs-like Extension Feature?
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
Similar Messages:
Nov 7, 2010
I want to develop composite control where some of the work would be executed on client side. For that I am implementing IScriptControl.
ScriptReference points to a script file with client object.
Let's say I want it to have Listview(html select) control that onselect will run javascript function based on the selected value.
I can't just create the control dynamically is client js, because the control has UI on design mode so I must create the select control on server side (I create it in override void Render)
My problem how and where to assign the onselect event for the selection.
Update: Maybe I should add select's id as property to ScriptControlDescriptor, then in client control retrieve this id and attach the needed handler to the event?
View 3 Replies
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
Oct 18, 2010
namespace MvcLogin_Validation.Helpers
{
public static class LabelExtensions
[code]...
View 4 Replies
Mar 21, 2011
Can I create a Google alert [URL] programmatically using C# and consume the feed to show in an asp.net application?
View 2 Replies
Jul 29, 2010
I want to make a bar chart from the google analytics data. Current implemetation of the bar chart in my site is by See Analytics I am developing an ASP.NET website and this See Analytics is using PHP and jQuery to conjure the chart. It is also paid. What my client would like is a similar tool that draws chart from analytics, without a PHP Component in it. ie. A similar tool using ASP.NET and jQuery/javascript. What I would like is to get that tool for free(open source).
View 3 Replies
Aug 11, 2010
As an organisation, we use Google Apps. We have the paid version (mapped to our domain) etc...We are developing a web based application to manage orders, and other business functionality.I want to be able to use federated login with our google apps accounts-
For example, if a user is logged in to their email (gMail) - they should automatically be logged in to our ASP.net application
If they're not logged in - the log in form should auth. against our google apps account.How can this be done?Is it possible to be able to "get" the user who is currently logged in using this method etc...?
View 3 Replies
Jan 11, 2011
I've implemented a google map with points and stuff that uses an address that the user inputs. When you click a point, the popup bubble appears with the name and address in.Often this name and address is a prominent location, as it's used for meetings and things, such as a university. If you google the address yourself on maps.google.co.uk then you get google's own popup bubble, which often has a photo, information, opening hours, links to directions, reviews, etc. etc.I am wondering if there's a way to use that popup dialog instead of my own, where it is available. I can't see anything in the API to do this.I'm using V2 as we support IE6 in a lot of our users, but I've been told recently I can upgrade to V3 should I need functionality from it.
View 1 Replies
Aug 22, 2010
just want to add the effect of map momentum by the dragging of map as in maps.google.com has. currently on my map where i stop dragging the map stops there but in maps.google.com if you drag a mouse the map will not stop there it will continue the movement in the same direction for a second or few cordinates (i dont know basically), but I want the same thing on my google map. I am using GMap2.
View 1 Replies
May 7, 2015
I want to download a file from google drive (like .docx, .xlsx etc.) to a specific location, I am able to do so which are publicly share using WebClient object.
But now I want to download file which private in share but unable to do it.
How to improve my code which should download private file also.
//Parameters
//1) Link - google drive link from where to download
//2) filename- name of filename-
//3) oringinalDocDirectory- path where file has to save
public ActionResult SaveToServer(string Link,string filname,string oringinalDocDirectory) {
if (!Directory.Exists(oringinalDocDirectory))
Directory.CreateDirectory(oringinalDocDirectory);
var docFinalSavePath = Path.Combine(oringinalDocDirectory, filname);
WebClient client = new WebClient();
client.DownloadFile(new Uri(Link.Replace("&export=download","")), docFinalSavePath);
return Json(new { status = docFinalSavePath }, "text/html", JsonRequestBehavior.AllowGet);
}
View 1 Replies
Sep 3, 2010
I am using VSTS 2008 + C# + .Net 3.5 + IIS 7.0 + ASP.Net to develop a simple web application. I want to add RSS feature to some of the pages of my web site, so that people could use their popular RSS reader to receive notification of content update.
Any easy way to do this in my development environment? I only need very basic RSS feature.
View 2 Replies
Jan 9, 2010
I'd like to add a search feature in my page (addviolation.aspx) just like in windows GUI. I have a search link in my page and if click on that link a new small browser (memberlist) will appear in front of the page (addviolation.aspx) that contains list of members. If I select on one of the member on the list, then it will appear on my first page (addviolation.aspx).
View 4 Replies
Aug 19, 2010
I have a alreday developed web application. Now I am wishing to add MetaDescription and MetaKeywords feature. I have downloaded codes from here
****. This is my own post but now it is wondering me when I am using that code and codebehind in my project. Well here is my codes and errors.
Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load ' Changing title of the Page Page.Header.Title = String.Format("Header Content ({0})", DateTime.Now)
' Changing background of Page
Dim myStyle As New Style()
myStyle.BackColor = System.Drawing.Color.Red
Page.Header.StyleSheet.CreateStyleRule(myStyle, Nothing, "html")
' Creating Meta Description
Dim metaDesc As New HtmlMeta()
metaDesc.Name = "DESCRIPTION"
metaDesc.Content = "A sample of using HtmlMeta controls"
' Creating Meta Keywords
Dim metaKeywords As New HtmlMeta()
metaKeywords.Name = "KEYWORDS"
metaKeywords.Content = "HtmlMeta,Page.Header,ASP.NET"
' Adding Meta controls to HtmlHead
Dim head As HtmlHead = CType(Page.Header, HtmlHead)
head.Controls.Add(metaDesc)
head.Controls.Add(metaKeywords)
End Sub
End Class
<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
This is my content.
<br />This is my content.
<br />This is my content.
<br />This is my content.
<br />This is my content.
</asp:Content>
Error:
NullReferenceException was unhandled by user code
See underlined code that has error.
Is I have to add something inside web.config file or anything else?
View 8 Replies
Jan 4, 2011
I need a working example of SQL 2008 File Stream example for overwriting the existing file contents.
View 2 Replies
Jan 20, 2010
T4 templates have saved me tons of work so thanks to the creator.In my site.master I have problems with the CSS files.My source looks like:
[Code]....
When I run my site it produces the following HTML:
[Code]....
As you can see the result paths are a little bit freeky :) (For the record when I use Links on script tag all is good.
View 2 Replies
Jul 6, 2010
I am a c# developer and am working on a web site that contains user accounts. I am trying to add a chat feature like facebook. Only direct chat is to be available like IM, a logged in user in the website should be able to chat with only logged in users. And the user can chat with only one other user at a time. If he wants to chat with another user, he must open a new chat window for him seperately. Which is exactly like facebook's chatting system. Any guides how to go about this. I am a newbie in web applications. Also, preferred language to go about his is asp.net.
View 6 Replies
Feb 21, 2012
I'm in the process of creating a form with a billing and mailing address. How do I create a "SAME AS ABOVE" TEXT box but yet still allows for a different address to be supplied on the form. I'm not too sure on how to code this. I AM USING VB.NET 2005 AND SQL SERVER2005 ....
View 1 Replies
Jun 5, 2010
I try to use routing feature on vs 2010 but it isn't running? May I have some wrong . Here is my code:
[code]....
View 4 Replies
Mar 4, 2010
On this site if you do too many clicks or post comments too fast or something like that you get redirected to the "are you a human" screen. Does anybody know how to do something similar?
View 7 Replies
Mar 5, 2010
I need to set the webpart to administrators only. How can I allow only shared scope. User scope is not allowed even for administrators.
View 1 Replies
Oct 6, 2010
Got the ProviderException : The Role Manager feature has not been enabled.
So far so good.
Is there somewhere a method that can be called to check if the Role Manager has been enabled or not?
View 1 Replies
Jan 28, 2010
I installed Visual Web Developer 2005 Express in Window Vista Home Edition. In this VWD 2005 Express, I can only create a new web site, not aweb project. So I installed Service Pack for this Express, vs80sp1-kb926751-x86-intl.exe. After this installation, I haven't found a new web project yet.
View 5 Replies
Nov 2, 2010
I use SQL Server and when I create a new table I make a specific field an auto increment
primary key. The problem is some people told me making the field an auto increment for the primary key means when deleting any record (they don't care about the auto increment field number) the field increases so at some point - if the type of my field is integer for example - the range of integer will be consumed totally and i will be in trouble.
So they tell me not to use this feature any more.The best solution is making this through the code by getting the max of my primary key then if the value does not exist the max will be 1 other wise max + 1.Any suggestions about this problem? Can I use the auto increment feature?I want also to know the cases which are not preferable to use auto increment ..and the alternatives...note :: this question is general not specific to any DBMS , i wanna to know is this true also for DBMSs like
View 6 Replies
Apr 22, 2010
I wanted to make use of AJAX 4.0 new feature of ClientIDMode.I have a dropdownList inside updatePanel. I defined a unique ID for this control and set the ClientIDMode to be static.The problem is , when I select the dropdown list, the page jumps(postbacks). However this does not happen if I remove the Static setting for CleintIDMode. I have also downloaded a new ajax 4.0 dll from the codeplex library
View 1 Replies
Feb 23, 2010
Every time you search for post on SOF, you can browse through the result with page-navigation feature. How do I create a Paging feature like SOF?
View 2 Replies