|
From server side you have access to any process using System.Diagonistic.Process
To stop / start service from ASP.NET use this:
int timeoutval = 20;
ServiceController svcController = new ServiceController("servicename");
if (svcController != null) {
try {
svcController.Stop();
svcController.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(timeoutval));
svcController.Start();
} catch (Exception ex) {
}
}
Remember to add <identity impersonate="true"/> in Web.config.
Also check if "Enable anonymous access" is disabled and "Integrated Windows Authentication" is enabled or not in IIS.
Hope this helps you.
|
|
|
|
|
Thanks for your responses,
That helped a Lot.
I am also posting a new Query related to VBScript, please if you could just see and give me some Idea.
I am really stuck on this issue and need to take a quick decision on it.
Pleaseeeeeeeeeeeeee Help me.
|
|
|
|
|
VikashGohil wrote: Thanks for your responses,
That helped a Lot.
But ensure that the web page that controls the windows service is protected under some authentication lest any Tom, Dick or Harry can run a bot for superflous overwhelming of your web server's service control manager.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep!
|
|
|
|
|
Hello
I want to add thousand seperator in ASP .NET gridview to the value numbers. And the auto generated columns property set to true, so there are no columns that are already defined.
Waiting for the solution.
Thanks in advance.
|
|
|
|
|
In such case, modify you SQL to give you formatted output. See here[^]
|
|
|
|
|
actually i cant take it from sql, whatever i have to do is do it from code behind....
thnks for the reply, but any other alternative ???
|
|
|
|
|
|
hi,
Iam working with asp.net with c# in VS.Net 2008. And in a task of mine
I am fetching a data from the DB which contains a embed html for eg:
" <object width="230" height="155">
<param name="movie" value="http://www.youtube.com/v/Ab9kmqBmhXc&hl=en&fs=1&"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube.com/v/Ab9kmqBmhXc&hl=en&fs=1&" type="application/x-shockwave-flash"
allowscriptaccess="always" allowfullscreen="true" width="230" height="155"></embed></object>"
In this fetched data i need to get only the
value="http://www.youtube.com/v/Ab9kmqBmhXc&hl=en&fs=1&"
or
src="http://www.youtube.com/v/Ab9kmqBmhXc&hl=en&fs=1&"
I need only the value or src(i.e) the url Bcoz i need to use that Url for some other purposes also.
Kindly help me in getting the value. Thanks in advance.
|
|
|
|
|
Use regular expressions to filter it. Please google for regular expressions patterns that can search url including query strings.
|
|
|
|
|
Thanks For ur Information
& I already Googled but not yet derived any suitable solution.
|
|
|
|
|
|
2 ways to do this.
1) Regular expression
2) Loading the content into XmlDocument and using XPath to query.
2nd method will be easy to implement. Sample XPath query,
/object/param[@name='movie']
This will give all param elements which have a name attribute with value movie . From this, you can easily get value of attribute value .
|
|
|
|
|
Thanks for ur kind reply,
I need the solution in the 1st way i.e Using RegularExpression coz am working with C# + asp.net. In the regex, it is possible to find the keyword value or src but what i need is url that follows these value or src.
I tried for it but failed to proceed further in getting that specified Url.
|
|
|
|
|
Try this.
bool TryGetVideoUrl(string input, out string url)
{
url = string.Empty;
string pattern = "embed.src=\"(?<video>[^\"]*)\"";
Match match = Regex.Match(input, pattern, RegexOptions.IgnoreCase);
if (match != null)
{
url = match.Groups["video"].Value;
return true;
}
else
return false;
} Use it like,
string url;
if (TryGetVideoUrl(input, out url))
{
}
else
{
}
|
|
|
|
|
Thank You,
I have rated this reponse to the most. thanks one again..
|
|
|
|
|
I have developed a project in asp.net using vb.net for coding.Earlier the project was working fine but now it is displaying the error 'DNS Error Server Cannot be Found in asp.net'.Actually the flow is like there is a login page,menu page and then a gridview page.What i did is that i dropped the table which was the source for the data in the gridview and then i recreated it.Since then all the earlier pages which are login page,menu page and even the gridview page show this error.However,the other pages in the project seem to be loading fine.Another thing is that this error occurs on page load.All these pages are physically present in the project directory but still it shows page cannot be found.I have developed this project in Visual Studio 2003
|
|
|
|
|
shylock1 wrote: 'DNS Error Server Cannot be Found in asp.net'.
This would suggest that something is wrong with the URL links in these pages. DNS error implies that the system is trying to resolve a host name to its IP address and getting a lookup failure.
|
|
|
|
|
Is the web server running?
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep!
|
|
|
|
|
hi sir,
please help me,
sir actually my problem is this.
i have a crystal report for an application.and i am building this application on pc-1.and i gave oledb connection for crystal report from pc-1.means server name =pc-1.and now i use this application on pc -2 with virtual directory.and when i opened my crystal report. this will ask me for pc-1 uid and pwd.
please give me solution
|
|
|
|
|
vikas shukla wrote: nd now i use this application on pc -2 with virtual directory.and when i opened my crystal report. this will ask me for pc-1 uid and pwd.
This is just because of Authentication settings of Virtual Directory. Go To Properties of VD > Directory Security > Edit > Select Anonymous Chekbox > Apply
Then Try it once again !!
|
|
|
|
|
hi sir,
thanks for your response,
but sir i have got following error.
Logon failed. Details: ADO Error Code: 0x Source: Microsoft OLE DB Provider for SQL Server Description: Login failed for user 'system2\Guest'. SQL State: 42000 Native Error: Error in File C:\DOCUME~1\SYSTEM1\ASPNET\LOCALS~1\Temp\Standards {6779445C-4B88-4ED9-B061-78587FDC7B13}.rpt: Unable to connect: incorrect log on parameters.
and note that in error-i am building this application on system 2 and now i am trying it for system1.i mean i am developing my application on system2 and oledb connection for crystal report is of system2.and now i am trying it for system1.
|
|
|
|
|
Open the Crystal report with Ms Visual Studio then CHeck it in design View
.A Popup will be Shown Then uncheck Integrated Security add the username and password.If Not Check the preview of the crystal report it will not display.Make Sure Your preview is displayed.
|
|
|
|
|
hello all,
i want to know how to develop discussion forum in asp.net 2.0
can we use treeview control or else???
i want to develop discussion forum similar to Codeproject forum.
Thanks in advance.
Regards
Praveen
|
|
|
|
|
|
Thanks Abhijit
this article really solved my problem. thanks again.
|
|
|
|