|
Will do nicely. It's only available in framework 2.x.
---
b { font-weight: normal; }
|
|
|
|
|
If you need the added functionality that the regular expression offers, it's a better way. If you don't, the IndexOf way is more efficient.
You forgot to escape the value, by the way. And I really don't see the reason to check the value of Success before returning it...
Private Function InLine(ByVal Line As String, ByVal Value As String) As Boolean
Dim r As Regex = New Regex(Regex.Escape(Value), RegexOptions.IgnoreCase)
Dim m As Match = r.Match(Line)
Return m.Success
End Function
---
b { font-weight: normal; }
|
|
|
|
|
I'm still working with 1.1 so that is good to know when I move to 2.0 – thank you. I see your point with using the IndexOf and agree it will provide better performance then the function.
|
|
|
|
|
How do I access a web.config from my web service
I need to grab the connection string of one of many data basis
Regards
|
|
|
|
|
Access it the same way you normally would, ConfigurationManager.ConnectionStrings
only two letters away from being an asset
|
|
|
|
|
Sorry I'm lost here
Bit more info please
Regards
|
|
|
|
|
This What I have done It works fine But I need to get only the one from the default web.config file.
Dim the_string_final As String = ""
Dim the_string_temp As String = ""
Dim counter As String = 0
Dim connectionStrings As ConnectionStringSettingsCollection = _
WebConfigurationManager.ConnectionStrings
Try
Dim connectionStringsEnum As IEnumerator = _
connectionStrings.GetEnumerator()
Dim i As Integer = 0
While connectionStringsEnum.MoveNext()
Dim name As String = connectionStrings(i).Name
Debug.WriteLine(name)
Debug.WriteLine(connectionStrings.Item(i).ConnectionString)
counter = counter + 1
the_string_temp = "****Number: " + counter + " '" + connectionStrings.Item(i).ConnectionString + "'" + "NAME: " + name
the_string_final = the_string_temp + the_string_final
i += 1
End While
Return the_string_final
Catch ex As Exception
End Try
Return the_string_final
The output:
<string xmlns="http://spero.co.za/">****Number: 2 'Data Source=(local);User ID=sa1'NAME: SL2010WSConnectionString****Number: 1 'data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true'NAME: LocalSqlServer
|
|
|
|
|
I Have tried this as well and no luck
Dim rootWebConfig As System.Configuration.Configuration
rootWebConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(Nothing)
Dim connString As System.Configuration.ConnectionStringSettings
If (0 < rootWebConfig.ConnectionStrings.ConnectionStrings.Count) Then
connString = rootWebConfig.ConnectionStrings.ConnectionStrings("MyString")
If Not (Nothing = connString.ConnectionString) Then
Console.WriteLine("Mystring = {0}", connString.ConnectionString)
Else
Console.WriteLine("Mystring")
End If
End If
|
|
|
|
|
WebConfigurationManager.ConnectionStrings["Default"].ToString()
only two letters away from being an asset
|
|
|
|
|
Hi Mark
Will try.
|
|
|
|
|
Hi Mark
This works
Dim the_string_final As String = WebConfigurationManager.ConnectionStrings("SL2010WSConnectionString").ToString()
Thanx
Ok now next question, How do I edit this field in the web.config file?
|
|
|
|
|
HI
I tried this
Dim Config As System.Configuration.Configuration = WebConfigurationManager.OpenWebConfiguration("/SL2010WS")
Dim csSettings As New ConnectionStringSettings("SL2010WSConnectionString", new_string)
Dim csSection As ConnectionStringsSection = Config.ConnectionStrings
csSection.ConnectionStrings.Clear()
Config.Save(ConfigurationSaveMode.Modified)
Return (new_string + " was saved to web.config")
As soon as I try to save the file then the VS tells me I do not have access to this file.
I checked but the file is not read only
|
|
|
|
|
My web service[say, webmethod startstoptheservice()] and my windows service[say Service1] both reside on the same machine.
I am creating another web application(residing on a different web server) that will access the webmethod startstoptheservice() to monitor(start/stop/restart) the service1.
[I am able to monitor the service1 from a windows application.]
But when i try to do the same using above mentioned method some error message saying access not granted is displayed.
A part of the error message includes:
System.ComponentModel.Win32Exception: Access is denied --- End of inner exception stack trace --- at System.ServiceProcess.ServiceController.GetServiceHandle(Int32 desiredAccess) at System.ServiceProcess.ServiceController.Stop() at HPClient.ServicesAgent.StartStopTheService() in....
Is the solution i am envisioning to monitor a windows service remotely really possible...? What may be the possible solution to the problem i am having at present.Any ideas/suggestions/comments or pointers would be appreciated.
rabindra
|
|
|
|
|
Yes, Use WMI. This is simple and you can do all task which you can do it window console. Infact you can fire queries also.
Amit
|
|
|
|
|
Hi,
I need your suggestion, I have created an Windows service to mointer my mail id, it stores the content of the mail in the data base. I want to install my service in an remote system. I dnt know how to do it.
Plz suggest me how to install it in remotew machine........
Thanks in advance
Bye
Exelio
Know is Drop, Unknown is Ocean
|
|
|
|
|
i want to find a substring from a string.
like i have a string
str ="/abc/xyz/sdg/"
and i want to find "xyz" then could i achieve this
thanx
|
|
|
|
|
Use the IndexOf to get the start position of "xyz" and then user SubString to get that string out.
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
exactly waht i want to do i want to check that whether a particular string is in the string or not?
like
str ="C:\Inetpub\wwwroot\medicaps";
now i want ot check whether a wwwroot is in this string or not.
thanx
|
|
|
|
|
Well that is something completely different you know
Use the IndexOf () method. If it returns a positive number then it contains otherwise id does not.
And this is very basic stuff. Maybe you should read a book or something before developing anything serious...
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
if (youString.Contains("wwwroot");)
//do your thing
|
|
|
|
|
hi friends,
In my application, in one aspx page contains only .aspx.cs file no aspx page in that. Even when i try to run that page it takes to directory list and says that that aspx page is set as forbidden. Please anyone tell me what is the problem. Because I am new to asp.net I dont know how to resolve it.
Prya
|
|
|
|
|
Hi,
I am getting errors when I try to add a new user through the ASP.NET COnfiguration Tool. I'm not sure what it means, and how to fix it. Can some please help??
My SQL membership provider:
<membership defaultProvider="JdssSqlMembershipProvider" userIsOnlineTimeWindow="15">
<providers>
<clear />
<add
name="JdssSqlMembershipProvider"
applicationName="JDSS"
connectionStringName="JdssDatabaseConnection"
description="Stores and retrieves membership data from the local Microsoft SQL Server database"
enablePasswordReset="false"
enablePasswordRetrieval="true"
passwordFormat="Encrypted"
type="System.Web.Security.SqlMembershipProvider" />
</providers>
</membership>
And the error is:
An error was encountered. Please return to the previous page and try again.
The following message may help in diagnosing the problem: Exception has been thrown by the target of an invocation. at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Web.Administration.WebAdminMembershipProvider.CallWebAdminMembershipProviderHelperMethodOutParams(String methodName, Object[] parameters, Type[] paramTypes) at System.Web.Administration.WebAdminMembershipProvider.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status) at System.Web.UI.WebControls.CreateUserWizard.AttemptCreateUser() at System.Web.UI.WebControls.CreateUserWizard.OnNextButtonClick(WizardNavigationEventArgs e) at System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e) at System.Web.UI.WebControls.CreateUserWizard.OnBubbleEvent(Object source, EventArgs e) at System.Web.UI.WebControls.Wizard.WizardChildTable.OnBubbleEvent(Object source, EventArgs args) at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) at System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
I hope someone can help.
Regards,
ma se :->
|
|
|
|
|
How can I dispaly network drives in asp.net(with C#) appliation? How to set authorization to folders in a drive from asp.net?
Thanks,
Bhasker P
|
|
|
|
|
HI
Guys , i know , there are three types of authentication in ASP.Net windows,Form and passport ,what are the purpose of these authentication ?
|
|
|
|
|