Showing posts with label app. Show all posts
Showing posts with label app. Show all posts

Saturday, March 31, 2012

Subst Question

Anyone have insight as to why an ASP.NET app (1.1) would not recognize a substituted drive on the first page hit? I have done a subst e: c:\ for my local development (to mirror production), but every time that I hit the asp.net app (and force compilation maybe?) I get can't find portion of path e:\ error. (for logging components I have reference to e:\myfolder\logs in my web.config file.) If I hit my browser's back button and try again it works. Thanks in advance!

Not sure about your specific problem, but why not use Server.MapPath() to map relative paths to absolute? That way it will work on any server.
Sorry, I didn't have email enabled, so I'm just getting back to checking on this... Thanks for the comment. I'm not sure this applies, unless I'm not up-to-speed on Server.MapPath(). Isn't that just for relative path to physical path mappings? We use this regularly for web site content mapping. However, we have logging components that specify a non-web location on disk (the e: drive) for the log file location. The web site, itself, may be anywhere, just mapped with a virtual dir. Anyone else have any ideas on what's happening with ASP.NET?

Wednesday, March 28, 2012

Subtract days from a Date

How can I code my app to get this date:

11/1/2203

From this date:

11/15/2003

I need to Subtract 14 days from 11/15/2003 but I am not sure to go about doing this.

ThanksThis may help

Dim dteNewDate As Date
Dim dteOldDate As Date = "01/01/03"
Dim intNoOfDays As Int16 = 11

dteNewDate = DateAdd("d", -intNoOfDays, dteOldDate)

TextBox1.Text = dteNewDate
The easiest way to do this is to pass a negative number into Date.AddDays(). I was able to perform the transformation you described using the following code:


Private Sub Calendar1_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged
Label1.Text = Calendar1.SelectedDate.AddDays(-14)
End Sub

(This code should be run on a page with a Label and Calendar control if you want to try it out.)

Hope this helps.
<%
Dim dtmDate As DateTime
dtmDate = DateTime.Now()

Response.Write( dtmDate.ToString( "d" ) )

Dim AdddtmDate As DateTime

AdddtmDate = dtmDate.addDays(-14)

Response.write ("<br>")
Response.write (AdddtmDate)
%>
We recently wrote a simpletutorial example on working with Dates & Time in ASP.NET

Clay is right - just pass a negative number.

Bringing this back up. I found the information here very useful.

Can anyone tell me if there is a way to get what the last day of the month is? Like if the month is Febuary, I need to be able to detect 28 and 31 for March...


I don't think there is anything built in to get the last day of the month but you can use this little piece of code to get the last day of the month.

privateDateTime getLastDayOfMonth(DateTime d)

{

//get the first day of this month

int days = (d.Day - 1) * -1;

d = d.AddDays(days);

// add a month to this date

d = d.AddMonths(1);

d=d.AddDays(-1);

return d;

}

  

Monday, March 26, 2012

Suggestion for App

I am trying to do a web page with a network status on it for several apps. I have tried it one way and posted it here but no replies. Any suggestions on how to have it ping a server with many different servers with online if it gets a reply or offline if it gets the time out or cant ping. Any helpe would be appreciated.

Thanks

To simply ping a server it is as simple asMy.Computer.Network.Ping("hostnameOrIp")

It will return true or false.


Cool. What I am trying to do is take that information and put in a page that says Online or Offline. But I have several Servers to do this. Any suggestions? Thanks for replying by the way.

Well, do one ping per server :P The way ping works is that it tries to send small packets to the destinated IP, if the data gets through we have PING! (funny word btw ;-). Things will get a bit different if you want to check if the server answers on specific ports. But just to do ping on several servers is piece of cake:

If My.Computer.Network.Ping("server1") = true
response.write("Online")
else
response.write("Offline")
end if

If My.Computer.Network.Ping("server2") = true
response.write("Online")
else
response.write("Offline")
end if


I would setup an ArrayList to hold all the servers, then loop through them, ping, and print their status:

Dim arrServersAs New ArrayList()Dim intCountAs IntegerDim strMessageAs StringarrServers.Add("192.168.1.100")arrServers.Add("192.168.1.101")arrServers.Add("192.168.1.102")For intCount = 0To arrServers.Count - 1 strMessage ="Server " &CStr(arrServers(intCount))If My.Computer.Network.Ping(arrServers(intCount))Then strMessage +=" is online"Else strMessage +=" is offline"End If Response.Write(strMessage)Next
 
Hope this helps! Please do not forget to mark the helpful post(s) as Answer so future readers know what solved your problem.

MY is requiring declaration and where is it to be declared?

IfMy.Computer.Network.Ping(arrServers(intCount))Then


Are you using ASP 1.x or 2.0?
2.0

Well that is really strange, becuase My works just fine and I have tested it.

It should be an automatically inherited namespace. I guess the only thing I can suggest you to try it to put

Imports My

at the top of the code behind.

Also, are you using C#?


Heck no. I can't stand anything to do with C. LOL I am using VB.

It works to an extent. I have about 14 servers I do this and I want to be able to do:

XXX Online or XXX Offline

YYY Online or YY Offline

Right now it is accounting all of the being online becasue it is going to the first one.


Thanks,


I got it to work. I had to alter some of the code. I got rid of the arrays and the loop. I did use the rest of your coding. I appreciate your help.
Glad you got it working! Please mark the most helpful post(s) asAnswer for the sake of future readers. Thank you.

Thursday, March 22, 2012

Suppressing the URL in a asp.net app

Hi,

I've seen many Internet sites that suppress the URL or show the same URL all
the time your moving around different pages. You'll only see the real page
with it's path in the statusbar way down on the page.

How is that done in asp.net?

I have an example on this, in sweden, stockholm where I live we have a
wellknown kindergarten for older men (warehouse shop) named Clas Ohlson

http://www.clasohlson.se/

You'll also have them on a flaglink in finnish, norwegian and english
language just above the statusbar. So that you see what I mean.

Any ideas?

TIA

Kenneth PThe above link (http://www.clasohlson.se/) is using a frameset. The
address bar isn't updated since you're navigating within a frame of the
page frameset.

Since HTML Framesets are a client side technology, this approach would
work the exact same in ASP.NET.

More info on frames here:
http://www.w3schools.com/html/html_frames.asp
- Jon
http://weblogs.asp.net/jgalloway
Hi

They are using frames. Just look at the main page "View -> Sourece" and you
will see that page have some frame.
With right click on page you'll see that page has url. Click on top and also
on bottom to see that the page url is different.
Also take a look on frame stuff to undestand clearly what is happening.
There is no trick made in asp.net in that page.

Cheers.

"Kenneth P" wrote:

> Hi,
> I've seen many Internet sites that suppress the URL or show the same URL all
> the time your moving around different pages. You'll only see the real page
> with it's path in the statusbar way down on the page.
> How is that done in asp.net?
> I have an example on this, in sweden, stockholm where I live we have a
> wellknown kindergarten for older men (warehouse shop) named Clas Ohlson
> http://www.clasohlson.se/
> You'll also have them on a flaglink in finnish, norwegian and english
> language just above the statusbar. So that you see what I mean.
> Any ideas?
> TIA
> Kenneth P
Kenneth P wrote:
> Hi,
> I've seen many Internet sites that suppress the URL or show the same
> URL all the time your moving around different pages. You'll only see
> the real page with it's path in the statusbar way down on the page.
> How is that done in asp.net?
> I have an example on this, in sweden, stockholm where I live we have a
> wellknown kindergarten for older men (warehouse shop) named Clas
> Ohlson
> http://www.clasohlson.se/
> You'll also have them on a flaglink in finnish, norwegian and english
> language just above the statusbar. So that you see what I mean.
> Any ideas?
> TIA
> Kenneth P

That has nothing to do with asp.net or any other server-side technology,
it is client-side html.
The trick is to use a frameset as your first page. The URL shown is the url of that
frameset definition, the rest of the site works within that frameset.

For that site: use "View | Source" from the menu and scroll down to below the
<NOSCRIPT> section. (strange, a noscript section with embedded javascript...)

Hans Kesting
Hi jongalloway,

Hmmm...

Have you seen the same technology on pages without frames?

Kenneth P

"jongalloway" wrote:

> The above link (http://www.clasohlson.se/) is using a frameset. The
> address bar isn't updated since you're navigating within a frame of the
> page frameset.
> Since HTML Framesets are a client side technology, this approach would
> work the exact same in ASP.NET.
> More info on frames here:
> http://www.w3schools.com/html/html_frames.asp
> - Jon
> http://weblogs.asp.net/jgalloway
>

"Kenneth P" wrote:

> Hi jongalloway,
> Hmmm...
> Have you seen the same technology on pages without frames?
> Kenneth P
>
> "jongalloway" wrote:
> > The above link (http://www.clasohlson.se/) is using a frameset. The
> > address bar isn't updated since you're navigating within a frame of the
> > page frameset.
> > Since HTML Framesets are a client side technology, this approach would
> > work the exact same in ASP.NET.
> > More info on frames here:
> > http://www.w3schools.com/html/html_frames.asp
> > - Jon
> > http://weblogs.asp.net/jgalloway
Sorry about that empty post above, accidentally hit the Enter key :-)

here are some interesting articles that could solve your problem:
www.15seconds.com/issue/030522.htm
www.codeproject.com/aspnet/URLRewriter.asp

I hope this helps

"Tim Bens" wrote:

>
> "Kenneth P" wrote:
> > Hi jongalloway,
> > Hmmm...
> > Have you seen the same technology on pages without frames?
> > Kenneth P
> > "jongalloway" wrote:
> > > The above link (http://www.clasohlson.se/) is using a frameset. The
> > > address bar isn't updated since you're navigating within a frame of the
> > > page frameset.
> > > > Since HTML Framesets are a client side technology, this approach would
> > > work the exact same in ASP.NET.
> > > > More info on frames here:
> > > http://www.w3schools.com/html/html_frames.asp
> > > - Jon
> > > http://weblogs.asp.net/jgalloway
> >
Tim,

Thanks for the links.

Kenneth P

"Tim Bens" wrote:

> Sorry about that empty post above, accidentally hit the Enter key :-)
> here are some interesting articles that could solve your problem:
> www.15seconds.com/issue/030522.htm
> www.codeproject.com/aspnet/URLRewriter.asp
> I hope this helps
>
> "Tim Bens" wrote:
> > "Kenneth P" wrote:
> > > Hi jongalloway,
> > > > Hmmm...
> > > > Have you seen the same technology on pages without frames?
> > > > Kenneth P
> > > > > "jongalloway" wrote:
> > > > > The above link (http://www.clasohlson.se/) is using a frameset. The
> > > > address bar isn't updated since you're navigating within a frame of the
> > > > page frameset.
> > > > > > Since HTML Framesets are a client side technology, this approach would
> > > > work the exact same in ASP.NET.
> > > > > > More info on frames here:
> > > > http://www.w3schools.com/html/html_frames.asp
> > > > - Jon
> > > > http://weblogs.asp.net/jgalloway
> > > >

Suppressing the URL in a asp.net app

Hi,
I've seen many Internet sites that suppress the URL or show the same URL all
the time your moving around different pages. You'll only see the real page
with it's path in the statusbar way down on the page.
How is that done in asp.net?
I have an example on this, in sweden, stockholm where I live we have a
wellknown kindergarten for older men (warehouse shop) named Clas Ohlson
http://www.clasohlson.se/
You'll also have them on a flaglink in finnish, norwegian and english
language just above the statusbar. So that you see what I mean.
Any ideas?
TIA
Kenneth PThe above link (http://www.clasohlson.se/) is using a frameset. The
address bar isn't updated since you're navigating within a frame of the
page frameset.
Since HTML Framesets are a client side technology, this approach would
work the exact same in ASP.NET.
More info on frames here:
http://www.w3schools.com/html/html_frames.asp
- Jon
http://weblogs.asp.net/jgalloway
Hi
They are using frames. Just look at the main page "View -> Sourece" and you
will see that page have some frame.
With right click on page you'll see that page has url. Click on top and also
on bottom to see that the page url is different.
Also take a look on frame stuff to undestand clearly what is happening.
There is no trick made in asp.net in that page.
Cheers.
"Kenneth P" wrote:

> Hi,
> I've seen many Internet sites that suppress the URL or show the same URL a
ll
> the time your moving around different pages. You'll only see the real page
> with it's path in the statusbar way down on the page.
> How is that done in asp.net?
> I have an example on this, in sweden, stockholm where I live we have a
> wellknown kindergarten for older men (warehouse shop) named Clas Ohlson
> http://www.clasohlson.se/
> You'll also have them on a flaglink in finnish, norwegian and english
> language just above the statusbar. So that you see what I mean.
> Any ideas?
> TIA
> Kenneth P
Kenneth P wrote:
> Hi,
> I've seen many Internet sites that suppress the URL or show the same
> URL all the time your moving around different pages. You'll only see
> the real page with it's path in the statusbar way down on the page.
> How is that done in asp.net?
> I have an example on this, in sweden, stockholm where I live we have a
> wellknown kindergarten for older men (warehouse shop) named Clas
> Ohlson
> http://www.clasohlson.se/
> You'll also have them on a flaglink in finnish, norwegian and english
> language just above the statusbar. So that you see what I mean.
> Any ideas?
> TIA
> Kenneth P
That has nothing to do with asp.net or any other server-side technology,
it is client-side html.
The trick is to use a frameset as your first page. The URL shown is the url
of that
frameset definition, the rest of the site works within that frameset.
For that site: use "View | Source" from the menu and scroll down to below th
e
<NOSCRIPT> section. (strange, a noscript section with embedded javascript...
)
Hans Kesting
Hi jongalloway,
Hmmm...
Have you seen the same technology on pages without frames?
Kenneth P
"jongalloway" wrote:

> The above link (http://www.clasohlson.se/) is using a frameset. The
> address bar isn't updated since you're navigating within a frame of the
> page frameset.
> Since HTML Framesets are a client side technology, this approach would
> work the exact same in ASP.NET.
> More info on frames here:
> http://www.w3schools.com/html/html_frames.asp
> - Jon
> http://weblogs.asp.net/jgalloway
>

"Kenneth P" wrote:
> Hi jongalloway,
> Hmmm...
> Have you seen the same technology on pages without frames?
> Kenneth P
>
> "jongalloway" wrote:
>
Sorry about that empty post above, accidentally hit the Enter key :-)
here are some interesting articles that could solve your problem:
www.15seconds.com/issue/030522.htm
www.codeproject.com/aspnet/URLRewriter.asp
I hope this helps
"Tim Bens" wrote:
>
> "Kenneth P" wrote:
>
Tim,
Thanks for the links.
Kenneth P
"Tim Bens" wrote:
> Sorry about that empty post above, accidentally hit the Enter key :-)
> here are some interesting articles that could solve your problem:
> www.15seconds.com/issue/030522.htm
> www.codeproject.com/aspnet/URLRewriter.asp
> I hope this helps
>
> "Tim Bens" wrote:
>