473,406 Members | 2,273 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,406 software developers and data experts.

System.Net.HttpWebRequest.Create(url) Problem

Hello:

I am trying to send an email which body will be a local aspx page, but when I try to get the page html using System.Net.HttpWebRequest.Create(url) I am getting this error:

Invalid URI: The format of the URI could not be determined

I read that I need to provide the full URI but I do not know how to do that so that it works when debuging(here I get a path like this http://localhost:43898/MyAppName/...) my application and also on the real server where the application is hosted(here I get a path like this: http://www.myDomain.com/...).

I am using ResolveUrl("~/Member/AppSubmitNotification.aspx") but i do not know how to provide the full path to avoid this error.
Apr 12 '09 #1
1 5383
This is how i get my application root URL
Expand|Select|Wrap|Line Numbers
  1. public static string RootUrl()
  2.     {
  3.         return HttpContext.Current.Request.Url.AbsoluteUri.Substring(0, 
  4.                   HttpContext.Current.Request.Url.AbsoluteUri.IndexOf(HttpContext.Current.Request.Url.AbsolutePath) + 1);
  5.     }
  6.  
  7. public static string ApplicationRootUrl()
  8.     {
  9.         string root = RootUrl();
  10.  
  11.         if (root.Substring(root.Length - 1, 1) == "/" )
  12.             root = root.Substring(0, root.Length - 1);
  13.  
  14.         root += HttpContext.Current.Request.ApplicationPath;
  15.  
  16.         if(root.Substring(root.Length - 1, 1) == "/" )
  17.             root = root.Substring(0, root.Length - 1);
  18.  
  19.         return root;
  20.     }
  21.  
  22.  
Apr 27 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Mmm_moo_cows | last post by:
Hi, I'm new to the world of mysql and i'm having alot of trouble with it. All i want to do is create a page with a response form, e.g. name etc and some radio buttons (part of a uni project,...
0
by: xixi | last post by:
i have been tring to add a new catalog system on my local machine control center from remote server, after i create the host and node, i try to catalog the database, then when i try to access it,...
2
by: krp | last post by:
Yes I know, this isn't the rigth forum. Can anyone direct me to it? Or can anyone answer me? Here's the situation. I have a NTFS partition on a hd. It seems that the volume is corrupt or the...
3
by: Sojwal | last post by:
We are working on a asp.net application in which we need to send some data to a PHP application on another server. We are using HttpWebRequest object to 'POST' the data to a PHP page as key-value...
2
by: Dan Marino | last post by:
Hi, I have a very strange behaviour of the HttpWebRequest class. I have a page that has to send an email. This is an aspx page that I open from a page of my site in a new window and in this...
1
by: simba | last post by:
Hello, I am currently doing a project which requires me to develop an online booking system for hotels and integrate both bed and room booking. I have the room booking working but I cant seem to...
3
by: Co | last post by:
Hi All, I use a website in asp for which I have to type a username and password everytime I want to login. On the form are two fields for typing the username and password and one button LOGIN....
0
by: devoloperbattu | last post by:
in my project i have to nmap an ip give and in this code cmd = "nmap -O " + myip + "> /usr/local/apache2/htdocs/test/temp/tmp.txt" os.system(cmd) i scan for the os on the remote system. ...
0
by: dharmesh1810 | last post by:
dear all, i have developed program in VB6 as front end + SQL Server as back end + Crystal Report as Reporting Tools and vsflex grid as third party tools. program is running fine, my problem is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.