473,320 Members | 1,845 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Loading a Remote file

Hi,

I want to load contents of a remote HTML file and to display it on the ASP
..NET Web Page. The remote HTML file is not under any virtual folder and the
content & location may vary for each operations.

How can I do the same?

Thanks,
Anbu
Nov 19 '05 #1
7 2338
You can use your code to Access files on the server or in shares that do not
exist in your virtual directories, regarding your ASPNET system account has
sufficient privalges, or the account IIS is using.
This can also be overcome using impersonation.

To load this file, you can include the file in a place holder on the page,
or write the file out using System.IO

Regards

Grant
"Anbu" <An***********************@alcatel.com> wrote in message
news:1122285437.797571@slbhw0...
Hi,

I want to load contents of a remote HTML file and to display it on the ASP
.NET Web Page. The remote HTML file is not under any virtual folder and
the
content & location may vary for each operations.

How can I do the same?

Thanks,
Anbu

Nov 19 '05 #2
Can I have some example?

"Grant Merwitz" <gr***@workshare.com> wrote in message
news:u7*************@tk2msftngp13.phx.gbl...
You can use your code to Access files on the server or in shares that do not
exist in your virtual directories, regarding your ASPNET system account has
sufficient privalges, or the account IIS is using.
This can also be overcome using impersonation.

To load this file, you can include the file in a place holder on the page,
or write the file out using System.IO

Regards

Grant
"Anbu" <An***********************@alcatel.com> wrote in message
news:1122285437.797571@slbhw0...
Hi,

I want to load contents of a remote HTML file and to display it on the ASP
.NET Web Page. The remote HTML file is not under any virtual folder and
the
content & location may vary for each operations.

How can I do the same?

Thanks,
Anbu


Nov 19 '05 #3
Ok, here goes

I set the security on c:\test to allow everyone full control.
This is not neccesary, just your ASPNET accounts needs these privileges, or
you can impersonate a user on the server with sufficient privileges
CODE:

using System.IO;

// Specify file, instructions, and privelegdes

FileStream file = new FileStream("c:\\test\\test.txt",
FileMode.OpenOrCreate, FileAccess.Write);
// Create a new stream to write to the file

StreamWriter sw = new StreamWriter(file);

// Write a string to the file

sw.Write("Hello file system world!");

// Close StreamWriter

sw.Close();

// Close file

file.Close();

// *** Read from file ***

// Specify file, instructions, and privelegdes

file = new FileStream("c:\\test\\test.txt", FileMode.OpenOrCreate,
FileAccess.Read);

// Create a new stream to read from a file

StreamReader sr = new StreamReader(file);

// Read contents of file into a string

string s = sr.ReadToEnd();

Response.Write(s);

// Close StreamReader

sr.Close();

// Close file

file.Close();

"Anbu" <An***********************@alcatel.com> wrote in message
news:1122288077.300020@slbhw0...
Can I have some example?

"Grant Merwitz" <gr***@workshare.com> wrote in message
news:u7*************@tk2msftngp13.phx.gbl...
You can use your code to Access files on the server or in shares that do
not
exist in your virtual directories, regarding your ASPNET system account
has
sufficient privalges, or the account IIS is using.
This can also be overcome using impersonation.

To load this file, you can include the file in a place holder on the page,
or write the file out using System.IO

Regards

Grant
"Anbu" <An***********************@alcatel.com> wrote in message
news:1122285437.797571@slbhw0...
Hi,

I want to load contents of a remote HTML file and to display it on the
ASP
.NET Web Page. The remote HTML file is not under any virtual folder and
the
content & location may vary for each operations.

How can I do the same?

Thanks,
Anbu


Nov 19 '05 #4
Thanks Grant,

I have no problem in reading the text file, but displaying at the
appropriate place. I read the document using filestream classes.

If I use Response.Write to display the HTML Contents, it prints the contents
on the TOP or BOTTOM of the ASPX page. Whereas, I want to display the
content at a particular place. Because I have many controls placed as header
and footer. Somehow, I solved the problem by using Label and LiteralControl.
Still the content does not look fine. I'm looking for an alternate...

Thanks for your help.
"Grant Merwitz" <gr***@workshare.com> wrote in message
news:#H**************@TK2MSFTNGP09.phx.gbl...
Ok, here goes

I set the security on c:\test to allow everyone full control.
This is not neccesary, just your ASPNET accounts needs these privileges, or
you can impersonate a user on the server with sufficient privileges
CODE:

using System.IO;

// Specify file, instructions, and privelegdes

FileStream file = new FileStream("c:\\test\\test.txt",
FileMode.OpenOrCreate, FileAccess.Write);
// Create a new stream to write to the file

StreamWriter sw = new StreamWriter(file);

// Write a string to the file

sw.Write("Hello file system world!");

// Close StreamWriter

sw.Close();

// Close file

file.Close();

// *** Read from file ***

// Specify file, instructions, and privelegdes

file = new FileStream("c:\\test\\test.txt", FileMode.OpenOrCreate,
FileAccess.Read);

// Create a new stream to read from a file

StreamReader sr = new StreamReader(file);

// Read contents of file into a string

string s = sr.ReadToEnd();

Response.Write(s);

// Close StreamReader

sr.Close();

// Close file

file.Close();

"Anbu" <An***********************@alcatel.com> wrote in message
news:1122288077.300020@slbhw0...
Can I have some example?

"Grant Merwitz" <gr***@workshare.com> wrote in message
news:u7*************@tk2msftngp13.phx.gbl...
You can use your code to Access files on the server or in shares that do
not
exist in your virtual directories, regarding your ASPNET system account
has
sufficient privalges, or the account IIS is using.
This can also be overcome using impersonation.

To load this file, you can include the file in a place holder on the page,
or write the file out using System.IO

Regards

Grant
"Anbu" <An***********************@alcatel.com> wrote in message
news:1122285437.797571@slbhw0...
Hi,

I want to load contents of a remote HTML file and to display it on the
ASP
.NET Web Page. The remote HTML file is not under any virtual folder and
the
content & location may vary for each operations.

How can I do the same?

Thanks,
Anbu



Nov 19 '05 #5
Thanks Grant,

I have no problem in reading the text file, but displaying at the
appropriate place. I read the document using filestream classes.

If I use Response.Write to display the HTML Contents, it prints the contents
on the TOP or BOTTOM of the ASPX page. Whereas, I want to display the
content at a particular place. Because I have many controls placed as header
and footer. Somehow, I solved the problem by using Label and LiteralControl.
Still the content does not look fine. I'm looking for an alternate...

Thanks for your help.
"Grant Merwitz" <gr***@workshare.com> wrote in message
news:#H**************@TK2MSFTNGP09.phx.gbl...
Ok, here goes

I set the security on c:\test to allow everyone full control.
This is not neccesary, just your ASPNET accounts needs these privileges, or
you can impersonate a user on the server with sufficient privileges
CODE:

using System.IO;

// Specify file, instructions, and privelegdes

FileStream file = new FileStream("c:\\test\\test.txt",
FileMode.OpenOrCreate, FileAccess.Write);
// Create a new stream to write to the file

StreamWriter sw = new StreamWriter(file);

// Write a string to the file

sw.Write("Hello file system world!");

// Close StreamWriter

sw.Close();

// Close file

file.Close();

// *** Read from file ***

// Specify file, instructions, and privelegdes

file = new FileStream("c:\\test\\test.txt", FileMode.OpenOrCreate,
FileAccess.Read);

// Create a new stream to read from a file

StreamReader sr = new StreamReader(file);

// Read contents of file into a string

string s = sr.ReadToEnd();

Response.Write(s);

// Close StreamReader

sr.Close();

// Close file

file.Close();

"Anbu" <An***********************@alcatel.com> wrote in message
news:1122288077.300020@slbhw0...
Can I have some example?

"Grant Merwitz" <gr***@workshare.com> wrote in message
news:u7*************@tk2msftngp13.phx.gbl...
You can use your code to Access files on the server or in shares that do
not
exist in your virtual directories, regarding your ASPNET system account
has
sufficient privalges, or the account IIS is using.
This can also be overcome using impersonation.

To load this file, you can include the file in a place holder on the page,
or write the file out using System.IO

Regards

Grant
"Anbu" <An***********************@alcatel.com> wrote in message
news:1122285437.797571@slbhw0...
Hi,

I want to load contents of a remote HTML file and to display it on the
ASP
.NET Web Page. The remote HTML file is not under any virtual folder and
the
content & location may vary for each operations.

How can I do the same?

Thanks,
Anbu



Nov 19 '05 #6
Thanks Grant,

I have no problem in reading the text file, but displaying at the
appropriate place. I read the document using filestream classes.

If I use Response.Write to display the HTML Contents, it prints the contents
on the TOP or BOTTOM of the ASPX page. Whereas, I want to display the
content at a particular place. Because I have many controls placed as header
and footer. Somehow, I solved the problem by using Label and LiteralControl.
Still the content does not look fine. I'm looking for an alternate...

Thanks for your help.
"Grant Merwitz" <gr***@workshare.com> wrote in message
news:#H**************@TK2MSFTNGP09.phx.gbl...
Ok, here goes

I set the security on c:\test to allow everyone full control.
This is not neccesary, just your ASPNET accounts needs these privileges, or
you can impersonate a user on the server with sufficient privileges
CODE:

using System.IO;

// Specify file, instructions, and privelegdes

FileStream file = new FileStream("c:\\test\\test.txt",
FileMode.OpenOrCreate, FileAccess.Write);
// Create a new stream to write to the file

StreamWriter sw = new StreamWriter(file);

// Write a string to the file

sw.Write("Hello file system world!");

// Close StreamWriter

sw.Close();

// Close file

file.Close();

// *** Read from file ***

// Specify file, instructions, and privelegdes

file = new FileStream("c:\\test\\test.txt", FileMode.OpenOrCreate,
FileAccess.Read);

// Create a new stream to read from a file

StreamReader sr = new StreamReader(file);

// Read contents of file into a string

string s = sr.ReadToEnd();

Response.Write(s);

// Close StreamReader

sr.Close();

// Close file

file.Close();

"Anbu" <An***********************@alcatel.com> wrote in message
news:1122288077.300020@slbhw0...
Can I have some example?

"Grant Merwitz" <gr***@workshare.com> wrote in message
news:u7*************@tk2msftngp13.phx.gbl...
You can use your code to Access files on the server or in shares that do
not
exist in your virtual directories, regarding your ASPNET system account
has
sufficient privalges, or the account IIS is using.
This can also be overcome using impersonation.

To load this file, you can include the file in a place holder on the page,
or write the file out using System.IO

Regards

Grant
"Anbu" <An***********************@alcatel.com> wrote in message
news:1122285437.797571@slbhw0...
Hi,

I want to load contents of a remote HTML file and to display it on the
ASP
.NET Web Page. The remote HTML file is not under any virtual folder and
the
content & location may vary for each operations.

How can I do the same?

Thanks,
Anbu




Nov 19 '05 #7
Thanks Grant,

I have no problem in reading the text file, but displaying at the
appropriate place. I read the document using filestream classes.

If I use Response.Write to display the HTML Contents, it prints the contents
on the TOP or BOTTOM of the ASPX page. Whereas, I want to display the
content at a particular place. Because I have many controls placed as header
and footer. Somehow, I solved the problem by using Label and LiteralControl.
Still the content does not look fine. I'm looking for an alternate...

Thanks for your help.
"Grant Merwitz" <gr***@workshare.com> wrote in message
news:#H**************@TK2MSFTNGP09.phx.gbl...
Ok, here goes

I set the security on c:\test to allow everyone full control.
This is not neccesary, just your ASPNET accounts needs these privileges, or
you can impersonate a user on the server with sufficient privileges
CODE:

using System.IO;

// Specify file, instructions, and privelegdes

FileStream file = new FileStream("c:\\test\\test.txt",
FileMode.OpenOrCreate, FileAccess.Write);
// Create a new stream to write to the file

StreamWriter sw = new StreamWriter(file);

// Write a string to the file

sw.Write("Hello file system world!");

// Close StreamWriter

sw.Close();

// Close file

file.Close();

// *** Read from file ***

// Specify file, instructions, and privelegdes

file = new FileStream("c:\\test\\test.txt", FileMode.OpenOrCreate,
FileAccess.Read);

// Create a new stream to read from a file

StreamReader sr = new StreamReader(file);

// Read contents of file into a string

string s = sr.ReadToEnd();

Response.Write(s);

// Close StreamReader

sr.Close();

// Close file

file.Close();

"Anbu" <An***********************@alcatel.com> wrote in message
news:1122288077.300020@slbhw0...
Can I have some example?

"Grant Merwitz" <gr***@workshare.com> wrote in message
news:u7*************@tk2msftngp13.phx.gbl...
You can use your code to Access files on the server or in shares that do
not
exist in your virtual directories, regarding your ASPNET system account
has
sufficient privalges, or the account IIS is using.
This can also be overcome using impersonation.

To load this file, you can include the file in a place holder on the page,
or write the file out using System.IO

Regards

Grant
"Anbu" <An***********************@alcatel.com> wrote in message
news:1122285437.797571@slbhw0...
Hi,

I want to load contents of a remote HTML file and to display it on the
ASP
.NET Web Page. The remote HTML file is not under any virtual folder and
the
content & location may vary for each operations.

How can I do the same?

Thanks,
Anbu




Nov 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Brent | last post by:
I maintain a Sql Server database application whose forms are compiled in a .dll and kept in a remote web folder. The main .exe looks to the web folder to see if this .dll exists. If so, then it...
4
by: Razzbar | last post by:
I need to be able to conditionally load a remote script, using the "<script src=..." syntax. Or some other way. I've seen people writing about using the document.write method, but it's not working...
6
by: Pete Davis | last post by:
I'm confused about what precisely the limitations are on loading plugins in separate app domains. In all my previous apps that supported plugins, I've loaded them into the same domain as the app,...
0
by: Jeff | last post by:
Hello, I've run into a problem with my asp.net application and would like to know whether the error is likely with my remote host. The problem is an unhandled exception, and the exception...
2
by: Jeff | last post by:
Hello, I've run into a problem with my asp.net application and would like to know whether the error is likely with my remote host. The problem is an unhandled exception, and the exception...
1
by: Anbu | last post by:
Hi, I want to load contents of a remote HTML file and to display it on the ASP ..NET Web Page. The remote HTML file is not under any virtual folder and the content & location may vary for each...
2
by: hbchai | last post by:
I'm adapting the ajax-like asynchronous request pattern mentioned in this article: http://www.xml.com/pub/a/2005/11/09/fixing-ajax-xmlhttprequest-considered-harmful.html?page=2 for my Sudoku...
0
by: the_kiddie98 | last post by:
Hi, I have a C# project which handles web requests to a server. On my local machine, I can usually attach to aspnet_wp once and debug file (hitting breakpoints), however if I stop and want to...
6
by: Gouri.Mahajan7 | last post by:
Hello, When I press the button on the web page I am loading the user control on the web page. This user control is invoking some methods of the web service. The control on the web page is loaded...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.