Build A Common Utility Class For .net Together?
Sep 1, 2010Which method would you like to place in tyour common class in asp.net application? A common function which you use in almost all your asp.net project question.
View 5 RepliesWhich method would you like to place in tyour common class in asp.net application? A common function which you use in almost all your asp.net project question.
View 5 Repliesi was hoping to build the user/role configuration utility into my website. I have posted before, and from what i have read, you need to create your own user/role membership utility in your website.but, i noticed in the
Microsoft.net directory C:WINDOWSMicrosoft.NETFrameworkv2.0.50727ASP.NETWebAdminFiles, that this is the entire interface for managing roles and users for a web site as long as you use standard asp.net security.is it possible to copy this site into my site to have a ready-to-go interface for user management without a user needing to have visual studio? It seems like it should be possible with minimal code changes, but I might be wrong. Im just looking for a shortcut.
We have two applications. One application in .asp and second application in java.we want to build interface for universal authentication, so that one can access the other application once signed into one application.Both applications are using SQL database, but one is written in .ASP hosted on Windows server while the other is in JAVA hosted on a Linux server. The applications are currently resided on two different
servers.
requirements:
1)The end user are most likely to access the applications through .ASP first, then reach the 2nd application more like "back office" management system.
2)he JAVA application currently works well with IE web browser, but not very smooth with other browsers such as Firefox. Would like to make the application to be more compatible with other browsers.
I think this may be a question for the architecture forum, but it feels a bit newb to me, so here goes.
I'm trying to write a utility class to use throughout my C# ASP.NET websites. I am having trouble getting intellisense to see the methods in my class. What I'm doing is creating a static class and putting it in a namesapce and with a using directive, importing that class into the code-behind of my web form. But it's not working. I would also like to minimize the visibility of the code i.e. use the least accessible access modifier necessary for use in my util class.
[code]....
I have this method that I'm currently putting in each page I make, I know there should be a good way to move it to a single place for ease of maintenance and simplicity. I'm just not sure how I should handle the event handler. The event handler needs to be on each page, so how would I pass in a reference to the page properly so I can reference the event handler?
private void InsertLinkButton(string text, string id, UpdatePanel updateSummary)
{
LinkButton link = new LinkButton();
link.Text = text;
link.Click += new EventHandler(link_Click); <------
link.CausesValidation = false;
AsyncPostBackTrigger trigger = new AsyncPostBackTrigger();
trigger.ControlID = link.ID = "link" + id;
trigger.EventName = "Click";
Utils.Tag(link, placeHolderSummary);
updateSummary.Triggers.Add(trigger);
}
I have a class named utility in my App_code folder that holds the logic to set a labels text.
public void Mgr_BreadCrumbs(string text)
{
Manager.MasterPages.Master master = new Manager.MasterPages.Master();
Label lblHeader = (Label)master.FindControl("lblHeader");
lblHeader.Text = text;
}
And then in each of my pages I was trying to set it like this:
utility u = new utility();
u.Mgr_BreadCrumbs("Categories");
I'm getting am object reference not set to an instance of an object on the lblHeader.Text = text; line of code.
This is my first class ever buildt (I am a real beginner) in C#. My aim is to "Sanitize a string". The class should do: trim an input make the first letter upper case. Is there a way to better code it? Would it make sense to use a PARAMETER for a method like: CapitalizeFirstLetterTrim(string x) when I initiate an object I need write a lot of code like below, any other way to make it shorter?
UserInputSanitizer myInput = new UserInputSanitizer();
myInput.Input = " ciao world";
string ouput = myInput.CapitalizeFirstLetterTrim();
Useful resource http://msdn.microsoft.com/en-us/library/bb311042.aspx
----------- CLASS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebProject.Core.Utilities
{
public class UserInputSanitizer
{
// Backing variables
private string _input;
// Properties
public string Input
{
set { _input = value; }
}
private string _output;
// Backing variables
// Properties
public string Output
{
get { return _output; }
}
public string CapitalizeFirstLetterTrim()
{
// Trim
_input.Trim();
// Make First letter UpperCase and the rest levae lower case
_output = _input.Substring(0, 1).ToUpper() + _input.Substring(1);
return Output;
}
}
}
I have following two classes:
public class A : System.Web.UI.WebControls.Button
{
public virtual string X[code]....
As you must be seeing the class A and B have exactly the same code , my question is how can I make a common class for it and use these two classes.
we are develop a web application , i wants to write common function to get number of rows
in a table using sql strored procedure.
I am relatively new to asp.net environment.Recently working on a project, i discovered a problemi.e. I had to add using system.io to all file functions in any page. same for using sql functionsi.e. any method for that namespace had to be used in full like By adding the following section in web.config , ALL my pages automatically have access to that namespace
<namespaces>
<add namespace="System.Data"/>
<add namespace="System.Data.SqlClient"/>
<add namespace= "MySql.Data.MySqlClient"/>
<add namespace="System.IO"/>
</namespaces>
[code]...
I have a solution I'm working on in VS2010 Professional, using ASP.NET 4.0 with the AJAX Toolkit.This has been working fine, but when I started it up today, I got the runtime exception shown above. This exception occurs on any page with a control from the toolkit.Sometimes when I load a page, I get an exception "Could not load file or assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, ublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified." If I then reload the page (without making any changes), I then get the exception shown in the subject line.I tried dragging an AJAX Toolkit control from the toolbox onto a page, and then deleting it, and that worked - once. The next time I tried the page (or any other), I got the exception again. Dragging a control out didn't help this time.
View 5 RepliesI have a question regarding a situation that occurs with GridView, ObjectDataSource in ASP .NET application. The GridView is linked to the ObjectDataSource and both are included within an UpdatePanel letting the GridView to fill in an asynchronous way from a form in the same page so it gets more rows as the user enters the data:
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="ObjectDataSource1">
<Columns>
<asp:BoundField DataField="Name" HeaderText="Name" ReadOnly="True"
SortExpression="Name" />
<asp:BoundField DataField="Periodicty" HeaderText="Periodicty" ReadOnly="True"
SortExpression="Periodicty" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
SelectMethod="GetSessionNames" TypeName="Simulation"></asp:ObjectDataSource>
<asp:Label ID="Label27" runat="server" Text="Label"></asp:Label>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="NewWebSessionButton" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
I start the project with Visual Studio 2008, fill the form and it works correctly. Then I stop the execution: rerun again and the data I entered in the previous run is in the GridView. Is like some sort of cache saved the data from the session before. I checked that EnableCaching property is set to false for the ObjectDataSource. If I Rebuild Web Site in Visual Studio (not just Build) then it works corretly leaving the GridView empty. Is this caused just becuase of Visual Studio? Can it be turned off? And will it happen in the final IIS it will run on?
I want to build a survey system where you can build a form with questions and some answers to these questions and then members who will log in will be able to take the test.
Then i want to present the different results from the test in some diagram or something like that.
It may be obvious to everyone. I am learning this: what is difference between build solution and build website
View 2 RepliesI have a large solution which has multiple apps which all share some common site elements (masterpages, navigation, etc).
Currently, all of these get built into a single DLL
If my structure looks like:
WebRoot
- Common/
- Shared/
- Images/
- App1/
- App2/
- etc
Is there a build tool which will allow me to build WebRoot.dll, App1.dll, App2.dll? I don't believe this is possible in VS2008 or the MSBuild tool.
I have a TFS build set up to deploy an ASP.net project to a test server.The build works great, and deploys to the test server fine, but instead of putting it into the Website directory that my IIS webserver is configured for, it puts the build into Website_20100511.6
Why is the date suffixed to the directory name? Is there a way to turn that off so I can publish directly to the Website?
I'm writing some software that I have to ensure can only be installed on one machine. The plan is to have them download the application. The first time the application is ran, the app will find this unique value on the machine, encode it, and instruct the client to send it to us to get their license number. Then, of course, the value they gave us will be used to construct a license number that will only work on that machine.
A unique value per machine would be the best, but I'd settle for a unique value per the installation of windows (XP) on their machine.
Is there a utility to combine querystrings? I'm looking for something like:
Input: Combine("test=a&test2=b", "test3=c") Result: "test=a&test2=b&test3=c"
Input: Combine("test=a&test2=b", "") Result: "test=a&test2=b"
Input: Combine("", "test3=c") Result: "test3=c"
And maybe some weird ones:
Input: Combine("&test=a&test2=b", "?test3=c") Result: "test=a&test2=b&test3=c"
I would like to create a webpage that collects a users search criteria. Then when they click a button, send the parameters to the Windows Explorer Search utility and run it. Can this be done? If so, how? I am using asp.net to create my webpages.
View 1 RepliesCan the Microsoft TextTransform utility be used standalone? Since VS2010 is it still true as I can read: [URL] Preprocessed templates to allow embedding of template-based generation in arbitrary applications without a runtime T4 dependency. There is a new custom tool, new service APIs and new engine APIs to support this feature.
View 2 Repliesload bcp utility from C# code? I need to do that for .NET 1.1.
I need to move data from a flat file to a database, I was suggested to use BCP. Are there any other options in .NET 1.1?
I need to build web application that will do:1 - build web pages. 1a - build template for page. 2 - add module(by module I mean ContacUs form, Search, Billing System...). Each module can be constructed by submodules or diveded to submodules 2a - build module(add form, textbox, button...) and that all
entered data by user could be saved in dbCan you advise me a DB structure that will contain it allI looked some cms db, but it's NOT this. Please, don't ask why I mess with it. I just need to build it.
I am looking for Backup and Restore . mdf file utility. Is there any opensource application/code available?
View 12 RepliesI am using xsd /c book.xsd to generate the a cs file. THe default cs file will be book.cs. I am wondering what swtich I can add so that i can name the generated cs file as document.cs instead of the default one. I attached the book/xsd and book.cs file, I am wondering why it generated two partial class? Should i name the generated file to match one of the partial class like BookForm.cs?
book.xsd:
[Code]....
Book.cs:
[Code]....
I need to implement Routing or Url-Rewriting in my application. So, is there any utility like logging utility Elmah. I dont want to write much code, I need to configure and start playing.
View 2 Replies