.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

Best method for replacing a URL string in large string

Posted By:      Posted Date: November 16, 2010    Points: 0   Category :.NET Framework


I need to replace a URL in a large string object containing either AtomPub or JSON content, with another URL. What would be the best method of doing this? The content could end up being very large say several megabytes or larger in size, so I want to make sure i'm using the best method.


View Complete Post

More Related Resource Links

Capture and pass "abc\xyz" as a string into my WCF method

Hi All, I am trying to implement WCF Method where client has to pass like "abc\xyz" as a string i have to capture it and pass to my method. I am not able to do it. In our application we can split the string  and we can do what ever we can do . but string comes from client site so who do i capture into my method. I am very much new in WCF. Could u please help me. Thanks Shekhar  

how to get a class reference as a reference and not a string to send for a generic method

I got some property that i get using generic method, there for I dont have it's <T>and I want to send it to another generic method but , how the heck do I get it's <T> :P?please look at the code below to understandit gets an entity framework objects, scan all it's properties and if the property is another entity framework object it would send it back to him self , the issue is that i dont know the new object <T> to send it back to him self :(search for the bold part to see what i'm missing//contains objects which we added so there wont be double adding private List<object> _addedObjects; public FakeGenericRepositoryExtension() { _addedObjects = new List<object>(); } public void Create<T>(T entity) where T : class { //add to created objects _addedObjects.Add(entity); //do something with object //... //start recircle process Type entityType = typeof(T); //run thrue each member of Type foreach (var member in typeof(Type).GetProperties()) { //get member value var member_value = member.GetValue(entity, null); //if not null //we must test this otherwise we can't get .BaseType if (member_value != null) { //get current member's base type string memberBaseType = member.GetValue(entity, null).GetType().BaseTyp

Call specific web service method by matching string value to method name?

I am getting a value in string format.  Then, I call a web service and try to dynamically call the method that corresponds to the string's value.  It doesn't work.  Any ideas?              Dim methodname As String = "getquotes"                 Dim track As localhost.Tracker = New localhost.Tracker()                 'the below line is where it fails                 track.methodname(parameter)               

Replacing numbers from a string


I am trying to run the below but I cant get it to work. Anything that can be done here, I just want to remove all the numeric characters.

select REPLACE('abc3434343','%[^0-9]%','')

Best Method to remove special character from string

I am trying to remove the special characters from a string that was entered by the user.  I am not sure the best method to do this.  i can get a foreach of all the characters but what do i check it against?
Christian - developer

reposted with no help: passing a string parameter to a web method


I have a web form (html) and I'm trying to pass a single string as a parameter to my web method, (this should be simple but no one can seem to answer me)

<script type="text/javascript" language="javascript">
        var qs = new Querystring();
        var v1 = qs.get("TorVName");
        //var jsonData = JSON.stringify(v1);  
        //var list = v1;
        //var jsonText = JSON.stringify({ list: list });
        $().ready(function() {
                type: "POST",
                url: "Default.aspx/GetColumns?TorVName=" + v1,
                data: {},
                contentType: "application/json; charset=utf-8",

Question about GroupPrincipal.FindByIdentity(PrincipalContext, String) Method and AD account permiss



I have an ASP.NET application that uses System.DirectoryServices.AccountManagement.GroupPrincipal.FindByIdentity (PrincipalContext, String) method to get a group principal object.  When the code runs under an AD account that has the "Read All Properties" permission for an AD global security group then the corresponding group principal object can be instantiated without problems.  However, this "Read All Properties" permission consists of fifty or so more detailed permissions to read properties like "Name", "Description", "msExchLabeledURI" and so on.  Some of these properties can be locked down for some AD accounts and I found that GroupPrincipal.FindByIdentity method may return a NULL in such cases. Is there a minimum set of group properties an AD account should have the Read permission to so the FindByIdentity method could instantiate the corresponding GroupPrincipal object?

Thanks in advance!


Replacing last comma in string with different character


Hi i have a string, and i want to replace the last comma with something else. For instance this is my string;

"Monday, December 6, 9:00 PM"

How do i replace that last comma so it can look like this;

"Monday, December 6 2010 9:00 PM"

Large string (.4gb) crashes simple C# vista/windows 7 when complied for any CPU



I have a program that converts csv files into XML files, this process runs on its own machine which has plenty (6gb) of ram. Part of the process is to read the entire contents of the CSV file into RAM. Typically the CSV files are no more then 20-40kb in size.

A new file type has been added to the system and it is about half a gig in size. Now I know there are better ways to handle this file, and I've already addressed that. I just wanted to give some background on HOW I found the problem.

If you create a new c# console app (vs2008 or vs2010) and paste in the code below on a 64bit Vista or Windows 7 pc, You may crash (total lock up) your PC. If you specify the processor to be x86 it runs fine...

Can someone explain this behaviour? I've tried three separate dev machines with the same results, but have no more to try.

Please take care, as the only way I have found to recover from this is to power off....

 static void Main(string[] args)

Setting method parameters to accept only string or Type.


I have a dictionary object I'm working on that can take keys of either of two types: string or System.Type. Currently I have TKey set as object, and then explicitly check the type. Is there a better way to handle this?


as an example, in the below code, I want to ...

  replace IDictionary<object,IDataTranslator> with IDictionary<string or Type,IDataTranslator>

  replace the two internal dictionary with one, that is only string/Type - that way I don't have to do any redundant type checking?


//stores data for specialized/default translations between types/strings
//IDataTranslator is a custom interface used in the library
public class translators : IDictionary<object,IDataTranslator>
 //holds the string-based translators
 protected Dictionary<string,IDataTranslator> m_translators_s;
 //holds the dictionary based translators.
 protected Dictionary<Type,IDataTranslator> m_translators_t;

How to Encrypt Query String Parameters in ASP.NET

Encrypt Query String Parameters in ASP.NET.u can send secure data one page another page u can also use query string to encrypt

Connestion string create any database server

This links important to how to create connection string to any data base sever.

SQL Connection String

We can learn or know how can we connect the database from our .net. This will help for freshers or .NET beginners!

Built-in Functions - String Functions

String functions let you extract various portions of character strings, change the case of strings, concatenate and reverse strings and perform many other types of manipulations. All built-in string functions are deterministic with the exception of CHARINDEX and PATINDEX

abstract away the source of the connection string using a class with a static property.

ASP.NET provides a configuration system we can use to keep our applications flexible at runtime. In this article we will examine some tips and best practices for using the configuration system for the best results.

The element of a web.config file is a place to store connection strings, server names, file paths, and other miscellaneous settings needed by an application to perform work. The items inside appSettings are items that need to be configurable depending upon the environment, for instance, any database connection strings will change as you move your application from a testing and staging server into production.

Let's abstract away the source of the connection string using a class with a static property.

highlight string


i am looking for a function that takes two string parameters 

str1 = "hello how are you today mr john"

str2 = "how today"

and in return it shoud highlight the words "how" and "today".

Any ides? I prefer if its possible using reg expression...Thanks

Could some one tell me whats the Problem with this String Manipulation ??? C#.net



I store some values from code behind to a label which is Hidden !

<asp:Label ID="lbl_Hidden" runat="server" Visible = "false"></asp:Label>

and at the page load event i retrieve the value of the label & assign it to a string !

stringvalue = lbl_Hidden.Text;

Now i dont know why this manipulation does'nt work !

I've a character 'A' in the string and i'm unable to replace it with a space !

stringvalue.Replace(A, " ");

Wot do u think abt it ????

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend