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?
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?
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.
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).
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...?
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.
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.
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); }
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.
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).
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
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.
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 ....
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?
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.
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
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