Building And Using A Utility Class For Forum?
Jan 6, 2011
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]....
View 6 Replies
Similar Messages:
Jun 20, 2010
I need assistance on the following issues, i am trying to create a site which involve forum , i need code for the following. or i need schema and data type for
1. last post
2. views
3. replies
4. user onlines
5.total post
6. thread.
7.last post like less than 5 minutes
View 14 Replies
Apr 6, 2010
I am in the process of creating a forum design from scratch, as my first official asp.net application attempt.
Overview:
I would like to handle this task in the following steps:
1) Get input from the user: txtLoginEmail, txtPassword
Form has been submitted:
2) Process inputs a) cut/trim white spaces
b) encrypt password by using SHA1 hashing method located in clsLibrary
3) Check the email address given against the database
Match: Display a message saying that the username already exists.
Doesn't: Add the email address and add encrypted password into the database
Question:
In my Register.aspx.vb code-behind file, inside of the question mark lines, how exactly do I check against
the database to see if that user exists in that database already? I thought perhaps storing the results in
an array and then looping through it to look for matches, but that sounds inefficient. I tried this idea
and after an hour I was unsuccessful. Below is my code for the class objects and pieces of code relevant to this task:
Database Design
---------------
UserID int IDENTITY(1,1) PRIMARY KEY,
UserEmail varchar(50),
UserPass varchar(50)
[code].....
View 4 Replies
Sep 1, 2010
Which 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 Replies
Jan 19, 2010
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);
}
View 2 Replies
Mar 23, 2011
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.
View 2 Replies
Nov 23, 2010
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;
}
}
}
View 5 Replies
Jun 10, 2010
I've got a web app solution containing a class library project.
Whenever I rebuild the class library and then refresh the page, it takes ages the first time, and is then quick again subsequently.
It's almost as if the newly rebuilt dll is having to 'bed in' to the app.
View 3 Replies
Jul 3, 2010
Im new to ASP.NET. Im trying to develop ecommerce web application and i found dynamic link building class and i dont understand how it works.
public class Link
{
// Builds an absolute URL
private static string BuildAbsolute(string relativeUri)
{
// get current uri
Uri uri = HttpContext.Current.Request.Url;
// build absolute path
[code]...
View 3 Replies
Dec 7, 2010
I have a project which contains only .vb files. It doesn't include a suitable main() method to detect the entry point?
View 1 Replies
Feb 27, 2011
i do knot know how to make a forum, step by step , in the forum people show their picture and user name
View 3 Replies
Dec 20, 2010
I want to Create a forum like "asp.net forum" in My Application.So i want to know that easy flow of making forum list in my Application and how to store it in database.I dont want to make my page loading time is slow. .
View 6 Replies
Mar 3, 2011
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.
View 2 Replies
Apr 28, 2010
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"
View 5 Replies
Mar 2, 2010
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 Replies
Dec 22, 2010
Can 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 Replies
Mar 11, 2010
load 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?
View 1 Replies
Apr 29, 2010
I am looking for Backup and Restore . mdf file utility. Is there any opensource application/code available?
View 12 Replies
Mar 17, 2010
I 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]....
View 3 Replies
Oct 31, 2010
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
Apr 29, 2010
i have designed a website in my desktop and used WAT of visual studio 2008 from Website menu and then selecting ASp.Net configuration.
Now i have copied my website to a server in my local network, server name=isaserver.
i try to access WAT utility of my website at isaserver. when i change webconfig file to correct data source, utility is working but
if i create a user using my website's create user form, then that user appears in aspnetdb database of isaserver but i am not able to see that user using WAT utility.
if i create a user using WAT utility then i am not able to login into my website hosted at isaserver using that username.
no matter how i create a user, either through my website's create user form or through WAT which is mapped to isaserver, both the users will appear in aspnetdb database of isaserver.
View 7 Replies
Jul 22, 2010
I would like to encrypt the connectionstrings section in my web.config file using the : ASPNET_REGIIS utility However I'm running Windows 7 pro, that is without any IIS.
Is it possible for me to do it.
The path (on my local pc) to the website containing the web.config file is like this:
C:UsersmyUserDocumentsVisual Studio 2010ProjectsmyWebsitemyWebsiteWeb.config
View 3 Replies
Feb 18, 2010
I wants to implement free text search utility for my web project,
to implement greate search utility for free text.
Also i have some knowledge of SQL SERVER 2005's FULL Text utility.
View 2 Replies
Sep 3, 2010
I need to create SSIS Package for Microsoft tool preweblog utility.exe to modify the IIS LogFiles.
View 1 Replies
Mar 20, 2011
I am developing a network discovery utility in ASP.NET (VB.NET). The utility would crawl the complete network and find out maximum details about all the devices that
are connected to it. After some research i have found out that i can get the complete information about PCs and Servers using WMI but i am unable to find a way to get
information about other types of network devices such as Network Printers, Routers, Switches, IP Phones, Handheld devices etc. Can anyone point out in the right
View 1 Replies