• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 209
  • Last Modified:

2 buttons, 1 is for redirecting 1 is for upload.

Hi;

I have 2 buttons, 1 is for redirecting 1 is for upload a file. Redirection to a page works fine but I don't know the most feasible way to load a txt/xml file content and when redirecting button is clicked, it should redirect with the contents of the file. Any feasible way for this?

Regards.
0
jazzIIIlove
Asked:
jazzIIIlove
  • 3
  • 2
1 Solution
 
Jitendra PatilSr.Software EngineerCommented:
hi ,

please check the link below.
5 ways to send data between Asp.Net PAges

Http Post may be of help to you.

hope this helps.
0
 
jazzIIIloveAuthor Commented:
Thanks but it's not specific enough. It's a text file content, so which one is the best practice?
0
 
Jitendra PatilSr.Software EngineerCommented:
try the below hack.

read your whole text file data and store it in a byte array -> store it in a session object

go to the page you want -> create a byte array and restore the session object data in it.

again read the byte array and you will get all your text file data.

hope this helps.
0
 
jazzIIIloveAuthor Commented:
Hi,

Good tip, except for the case, the file must persist in remote file system if it's not there already, so session is a bad solution?
0
 
Jitendra PatilSr.Software EngineerCommented:
try the below one:

before adding the file path to session check for the physical availablity of file.

save your file to a location-> add its path to the session object.

go to next page get data of session object containing file path.

read the whole file it will be easier than the above one.

hope this helps.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now