|
Why does it have to work that way ? I wonder if you can set up two web apps in IIS that are called Client and ATP and point to the same base directory ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Malayil alex wrote: how will i manage this kind of url specifications...
You can use URLRewriting. You have to create a HTTPModule which listens the requests. If the incoming request is coming like http://www.xxx.com/Client/Add.aspx, redirect it to your real Add page with some querystring value to indicate it's a client request. Same way do for ATP also.
Context class comes with RewritePath() method. Make use of this.
|
|
|
|
|
Hi people,
I have a web service method that I would like to use to access a text file over the network, say the file is located at http://someserver.com/somefolder/myfile.txt . I have been searching with google and all I could find was how to read an XML file by providing a URL in this article: http://support.microsoft.com/kb/307643[^]
I was wondering if there was a way to do the same but with text files instead of XML files. It seems that TextReader or StreamReader do not access a URL as the path of the file.
Any insights are appreciated.
Thanks
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." --Rich Cook
|
|
|
|
|
Talal Sultan wrote: I was wondering if there was a way to do the same but with text files instead of XML files.
Talal,
You can make use of WebClient class. This can be used to download data from remote URL. See the following snippet explains how you can read the text file from URL
System.Net.WebClient wc = new System.Net.WebClient();
byte[] b = wc.DownloadData("http://someserver.com/somefolder/myfile.txt");
string Text = System.Text.ASCIIEncoding.ASCII.GetString(b);
That's it, you will get text file content in Text variable. Now use some kind of regular expressions to parse it and read the necessary content.
Hope this helps
|
|
|
|
|
Hi,
Thanks for the hint
I found 2 ways to do the job. I will post them here maybe it would help others having the same problem.
Using your code, I found that if we use the DownloadString , it works too. We can write:
WebClient wc = new WebClient();
string s = wc.DownloadString("http://someserver.com/somefolder/myfile.txt");
this will put all the text file in s . We will get of course \r\n each time there is a new line.
Another method can be used which can allow us to read line by line:
WebRequest wRequest = HttpWebRequest.Create("http://someserver.com/somefolder/myfile.txt");
WebResponse wResponse = wRequest.GetResponse();
Stream myStream = wResponse.GetResponseStream();
StreamReader sr = new StreamReader(myStream);
string firstline = sr.ReadLine();
This is even better as we don't have to parse the string to remove the \r\n or other special characters.
Voila. Thanks again for the hint
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." --Rich Cook
|
|
|
|
|
Thanks, I was thinking the second one too, but thought first will be good. Anyway nice comparison.
|
|
|
|
|
here i am using style sheet for non visible the div.bcoz i am using two div.in my search engine.one foe mysearch results and another for google results.here google div was set invisible at stylesheet.and i wrote javascript for displaying the div of googleresults and add this javascript at onclientclick of button control.when i run the program.google results invisible.becoz it again debug thepageload after google search.then it became invisible.how to solve this problem.
venkat
|
|
|
|
|
|
HI
I GOT THE RESULT THANKS FOR UR HELP
regards
venki
venkat
|
|
|
|
|
HI
I GOT THE RESULT THANKS FOR UR HELP
regards
venki
venkat
|
|
|
|
|
in codebehind sied you can set style of div
div.Attributes.Add("style","visibility:visible");
bEST rEGARD
pATHAN
please don't forget to vote on the post that helped you.
|
|
|
|
|
THANK U FOR UR HELP
I GOT THE RESULT
REGARDS
VENKAT
venkat
|
|
|
|
|
Hi,
I have a user control in which I have a save button.
When this button is clicked data will be saved to the database.
After button clicking if I refresh the page, then the same button click event is called again which is adding the data again in the database.
I tried all possibilities i found, but didnt able to get the solution.
Could anyone please let me know the solution for this.
Thanks,
Madhuri.
Madhuri
|
|
|
|
|
The problem is that a refresh does the postback again. The solution is to redirect your page in your button click event after saving. If your page has some state it needs to show, then pass a variable on the URL that reloads that state. Then, a refresh reloads the page with the variable, and shows the state, but does not execute the save event.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I have 3 drop downlist boxes upon whose selection a new record adding section will be displayed.
But If I redirect the page, the dropdownlistboxes values will be reset, which is not expected.
|
|
|
|
|
Well, unless you put the selections in the URL, they will obviously reset. You can't have it both ways. All state will be held in viewstate, or all state needs to be on the URL ( or in the session, but that should be avoided ).
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi There,
I believe you dont want the button Click to be called again.
I am not sure the solution will work or not, but try this,
Javascript
function DisableButton(buttonElem) {
buttonElem.value = 'Please Wait...';
buttonElem.disabled = true;
}
ASPX
<asp:button id="btnSubmit" runat="server" Text="Submit" />
C#
protected void Page_Load(object sender, EventArgs e)
{
btnSubmit.Attributes.Add("onclick", "DisableButton(this);" +
Page.ClientScript.GetPostBackEventReference(this,
btnSubmit.ID.ToString()));
}
I got this solution from the website itself.
I hope it works for you....
Thanks
Cheers
Menon
|
|
|
|
|
I don't think this will work. It stops a postback from clicking more than once, but not from a refresh.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I published my project to another virtual directory on my PC then run it and thrown an error ,but it works fine when i compile an run it in VS.NET 2005.
The error is...
<br />
Parser Error <br />
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. <br />
<br />
Parser Error Message: Ambiguous match found.<br />
<br />
Source Error: <br />
<br />
Line 1: <%@ page language="C#" autoeventwireup="true" inherits="_Default, App_Web_eid71yai" %><br />
Line 2: <br />
Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br />
<br />
<br />
Source File: /TestSmartSync/index.aspx Line: 1 <br />
Could anyone help me what is Ambiguous match found.?
Why does it work properly in VS.NET but doesn't work when it was published?
Thank for help =)
|
|
|
|
|
Have you perhaps copied the site up twice, windows has named one set 'copy of', or one set is in a subfolder, so it's finding two cs files that define the same class, and that's what's ambiguous ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi i have one msaccess database...,
In that i have given password to that mdb file...,
Before given password its bind the data in my form grid...
after given password its giving error as : Not a valid password
How to give that password in my codes?
Regards,
Magi
|
|
|
|
|
Provider="Provide Name" ;Data Source=C:\mydb.accdb;Jet OLEDB:Database Password=password;
Could u kindly try this using ur Connection String !!!
and it will work for you
Happy Programming
-----
Abhijit
|
|
|
|
|
|
you can set password in your connection string like
dbconn=New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;
data source=" & server.mappath("northwind.mdb"); password = "Password")
Girish Soni
|
|
|
|
|
Hi girish idf u give only password it wont work..,
Before that have to give that Jet OLEDB:database
Anyway thansk for reply
Regards,
Magi
|
|
|
|