C#: Server.Execute() and Server.Transfer() [Archive] - C Board

PDA

View Full Version : C#: Server.Execute() and Server.Transfer()


Grayson_Peddie
09-22-2003, 05:08 PM
IDE and Version: Visual C# .net 2002
.net Framework version: .net Freamework 1.1
Problem: Trying to instruct ASP.net to load another page from when a button has clicked.
Control Used: Image Button
Name of an image button: News
ID for the button: GPNews
Code for the News buton:

private void GPNews_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
if(!Page.IsPostBack)
{
Server.Execute("http://www.future-gpnet.com/news/news.aspx");
}
}
News page loaded successful?: No.
Attempt 2 - code for the News Button:

private void GPNews_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
Server.Execute("http://www.future-gpnet.com/news/news.aspx");
}
Page loaded succesfully: No.
Attempt 3 - code for the News Button:

private Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
btnGP.Click += new System.Web.UI.ImageClickEventHandle(this.GPNews_Cl ick);
}
}

private void GPNews_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
Server.Execute("http://www.future-gpnet.com/news/news.aspx");
}
Page Loaded successfully when the user clicked the News button?: No.
Web Hosting Service: UpLinkEarth
ASP.net version for UpLinkEarth: ASP.net 1.0
# of projects in Solution Explorer: 2
Name of projects in Solution Explorer: www.future-gpnet.com; News

Hi, there. I have problems when trying to execute (load) another page like the News Page when a user clicked a News button. I had tried 3 attempts for loading the page up but it wouldn't work. Well, I can tell that since UpLinkEarth uses .net Framework 1.0 (which contain ASP.net 1.0), then it sounds like it's not compatible with .net Framework 1.1... Since UpLinkEarth will be in maintenance mode in third week of October (Wednesday at 9:00 PM and ends on Thursday 4:00 AM), is there a workaround in how to make ASP.net execute a code when a user clicked or do I have to wait since during the UpLinkEarth's maintenance mode, UpLinkEarth are going to be installing .net Framework 1.1 (which contain ASP.net 1.1).

Thanks for taking your time reading my thread.

EDIT1: Made some mistakes in my code...

Grayson_Peddie
09-24-2003, 12:51 PM
Hey can someone help me out here?

I tried "Server.Transfer("index.aspx");" and it works.

Executing "Server.Transfer("Index.aspx");" returns a path in the URL:

"www.future-gpnet.com/index.aspx".

How do I execute a file called "News.aspx" inside a News folder?

What I'm trying to execute is:

"www.future-gpnet.com/news/news.aspx"

Thanks.

Hammer
09-24-2003, 04:37 PM
If this works:
"Server.Transfer("index.aspx");"

have you tried
"Server.Transfer("news/news.aspx");"

Grayson_Peddie
09-24-2003, 06:50 PM
It didn't work but I tried the Redirect mothod from the Page.Response. Thank you for your help.